L-System Pattern Generator
Generate fractal patterns using L-system grammar rules. Create botanical trees, plant structures, and recursive curves.
L-systems (Lindenmayer systems) model plant growth through grammatical expansion rules. Start with an axiom (e.g., "F"), then iteratively replace symbols according to production rules (e.g., "F → FF"). Each iteration adds detail; visualized as turtle graphics (forward, turn, push/pop position), L-systems generate realistic branching and fractal patterns used in computational botany and generative art.
L-System Generator
Rules
L-System visualization
Quick rules: F, G, A, B = draw forward, f, g = move without drawing, + = turn left, − = turn right, [ = push position, ] = pop position. Write one production rule per line, for example F=FF.
How L-Systems Work
| Concept | Definition | Example |
|---|---|---|
| Axiom | Starting string | A |
| Production Rule | Replacement applied each iteration | A → AB |
| Iteration | One application of all rules | A → AB → ABB → ABBB... |
| Turtle Graphics | Rendering symbols to drawing commands | F=forward, +=turn left |
L-systems model organic growth deterministically. Each iteration applies rules in parallel (not sequentially), creating fractal self-similarity. The same grammar produces identical results every time—perfect for reproducible generative art.
Classic Examples
Dragon Curve
Axiom: FX | Rules: X→X+YF+, Y→−FX−Y
Fractal Plant
Axiom: X | Rules: X→F+[[X]−X]−F[−FX]+X, F→FF
Sierpinski Triangle
Axiom: A | Rules: A→B−A−B, B→A+B+A
FAQ
What's the difference between L-systems and fractals?
L-systems are a method for generating fractals through grammar. A fractal is the result (self-similar pattern at all scales). L-systems are one elegant way to create them.
Can I create my own rules?
Yes. Define an axiom and production rules, then experiment with angles and iteration depth. Trial and error is part of the fun. See reference guides for proven patterns.
Why do more iterations get slower?
Each iteration doubles or triples the string length (depending on rules). By iteration 8–10, strings become hundreds of thousands of characters. Rendering millions of line segments takes time. Limit iterations to 6–7 for interactive speed.
Updated: September 2026 | L-System by Aristid Lindenmayer, 1968