ScratchData LogoScratchData
Back to popswilson's profile

Gosper's Flowsnake (Lindenmayer System)

POpopswilson•Created January 17, 2015
Gosper's Flowsnake (Lindenmayer System)
10
4
120 views
View on Scratch

Instructions

Click on the green flag. The snake will draw the 'initiator', the line segment that defines the size of the flowsnake. Press the space bar and the snake draws the 'generator', the shape that is drawn at smaller and smaller scales, on each of the smaller line segments. The flowsnske has a similarity fractal dimension of 2. As you can see in later iterations, the size of the flowsnake remains bounded but the curve is passing through more and more of the points within the boundary. At the infinite iteration, the snake will have passed through every point contained in the boundary, hence an area of dimension 2. Mathematics + Computer = Beauty

Description

This project was inspired by leszpio's recent Gosper Flowsnake project (http://scratch.mit.edu/projects/41687580/). His code is Logo-like and the recursive calls can be difficult for beginners to trace. I have found that many students find Lindenmayer's L-system string replacement method easier to understand. String replacement is equivalent to recursive calls so there is no difference in the final product. Gosper Flowsnake – L-system Definition Axiom: A Angle: 60º (+ = left 60º, - = right 60º) String replacement rules: A and B both mean 'move forward x steps A –> A - B - - B + A + + A A + B - B –> + A – B B – – B – A + + A + B If you are interested in understanding how the Flowsnake is coded you could contrast the L-system code in this project with leszpio's. The disadvantage of L- systems is that the string of A's, B's, +'s and –'s get very long. For example, the string for the fourth iteration in this project contains 39,215 of the above mentioned symbols. In Leszpio's project, the 'level' (iteration) is handled by the variable n.

Project Details

Project ID43655328
CreatedJanuary 17, 2015
Last ModifiedJanuary 19, 2015
SharedJanuary 19, 2015
Visibilityvisible
CommentsAllowed