Use the inputs above to design your L-curve! Use the delay to delay the drawing of each segment by milliseconds. Click on the name to change it. Warning: high iteration counts get intensive quick. L systems grow fast! Scale iteration count carefully.
A,S,D,F,G | Move turtle forward |
+ | Turn turtle to the right |
- | Turn turtle to the left |
[ | Save current position |
] | Return to saved location |
0,1,2,3 | Color line black, brown, green, red, respectively. |
Lindenmayer systems are a cool type of recursive grapher powered by a grammar parser and simple rules.
L systems take in strings. Those strings contain letters and symbols that the computer knows how to act on. The actions control the motion of a point on the screen. Classically, this is known as Turtle graphics.
Say your axiom (what you start with) is A, and you have two rules: A=AB, and B=A. L systems then go over each character in the axiom and apply a rule. In this case, we have input A, so after one iteration it becomes AB. Then you do it again. First character is A again, so you substitute AB for it, giving you ABB. The second character of the original string is B, so that becomes A, making the string ABA. Repeat that process again and you get ABAAB, followed by ABAABABA and ABAABABAABAAB.
This is quite possibly the first L system ever, constructed by Aristid Lindenmayer in 1968. It happens to closely resemble the growth of algae, not a coincidence since Lindenmayer was a biologist studying cyanobacteria. He developed L systems as a way to formally model the behavior of plants.
If you find this interesting, checkout The Algorithmic Beauty of Plants (chapter one), a book on computational botany that has lots of examples of L systems and far more rigorous explanations.
Sierpinski Triangle
Fractal Plant
Dragon Curve
Fractal Maze
Arrowhead Sierpinski Curve
Fractal Tree
Red Snowflake
Peano-Gosper Curve
Hilbert Curve
Fractal Snowflake
Hilbert Curve 2
32 Element Curve
Square Curve Interference
Koch Snowflake
Stringy Plant
Bushy Plant
Bushy Plant 2
Fractal Plant 2
Pretty Tree
anotherFractal
Divided Square