Explore how simple rules create complex organic structures
L-systems were introduced by biologist Aristid Lindenmayer in 1968 to model plant growth. They use recursive rewriting rules to generate surprisingly complex structures from simple initial conditions.
An L-system is defined by four components:
A tiny rule can produce thousands of drawing instructions after only a few iterations.
Axiom: F Rule: F → F[+F]F[-F]F
Iteration 0 F Iteration 1 F[+F]F[-F]F Iteration 2 F[+F]F[-F]F[+F[+F]F[-F]F]F[+F]F[-F]F[-F]F[+F]F[-F]F
After expansion, the resulting string is interpreted by a turtle graphics renderer that draws the visual structure.
| Symbol | Meaning |
|---|---|
F |
Move forward and draw |
A / B |
Alternative drawing symbols |
+ |
Rotate right by angle |
- |
Rotate left by angle |
[ |
Save current position and angle |
] |
Restore saved position and angle |
The bracket system [ and ] is what enables branching structures
like trees, bushes, roots, and coral forms.
The renderer maintains the current position (x, y), direction, and a state stack to handle branching.
F[+F][-F]
This simple mechanism creates hierarchical growth patterns found in nature.
Modify the axiom, rule, angle, and iterations below. Watch how small changes create dramatically different structures.
F draw forward+ turn right- turn left[ save position] restore position
Axiom: F Rule: F[+F]F[-F]F Angle: 25°
Classic symmetric branching structure. Each branch splits into two.
Axiom: F Rule: F[+F][--F][-F] Angle: 25°
Asymmetric branching creates leaf-like patterns.
Axiom: F Rule: F[+F][-F]F[-F][+F]F Angle: 20°
Dense multi-branch vegetation with complex structure.
Axiom: A Rule: AB
Lindenmayer's original algae model. Shows pure string expansion (Fibonacci pattern).
Axiom: F Rule: F[+F]F[-F][F] Angle: 22°
Balanced recursive branching pattern creating mathematical beauty.
L-systems grow exponentially. Even simple rules produce huge strings:
| Iteration | Approximate Command Count |
|---|---|
| 1 | 11 |
| 2 | 61 |
| 3 | 311 |
| 4 | 1,561 |
| 5 | 7,811 |
This is why even tiny rules quickly generate intricate, detailed structures.
Try changing these in the playground:
F[++F][--F] F[-F]F[+F]F F[+F[-F]] F[+F][+F][+F]
Small changes often produce dramatically different results.
Trees, vegetation, roots, coral structures, alien flora in video games and movies.
Fractal art, organic 3D modeling, environmental generation for VFX and games.
Plant morphology research, branching system analysis, growth pattern studies in biology.
SpeedTree uses L-systems to generate millions of unique trees with minimal memory overhead.