Visual Math

L-System Explorer

Grow recursive grammars into curves, plants, and space-filling paths, then watch the turtle interpreter turn symbols into geometry.

Scratchpad (not saved)

Rendered grammar

Change the axiom, rewrite rules, or turtle angle and the curve rebuilds from the grammar immediately.

Sequence 6,263Segments 1,488Branches 1,023
Full expansion rendered

Tip: use draw progress to reveal the order in which the grammar unfolds. Plant grammars are especially satisfying when animated from 0% to 100%.

Grammar growth

Each iteration rewrites every matching symbol, so complexity rises quickly. The current expansion lengths are 1 -> 18 -> 89 -> 379 -> 1551 -> 6263.

Turtle interpretation

`F` and `G` draw forward, `+` and `-` rotate, and brackets push and restore branch state. That makes the string both a grammar and a drawing program.

Current preview

FFFFFFFFFFFFFFFF+[[FFFFFFFF+[[FFFF+[[FF+[[F+[[X]-X]-F[-FX]+X]-F+[[X]-X]-F[-FX]+X]-FF[-FFF+[[X]-X]-F[-FX]+X]+F+[[X]-X]-F[-FX]+X]-FF+[[F+[[X]-X]-F[-FX]+X]-F+[[X]-X]-F[-FX]+X]-FF[-FFF+[[X]-X]-F[-FX]+X]+F+[[X]-X]-F[-FX]+X]-FFFF[-FFFFFF+[[F+[[X]-X]-F[-FX]+X]-F+[[X]-X]-F[-FX]+X]-FF[-FFF+[[X]-X]-F[-FX]+X]+F+[[X]-X]-F[-FX]+X]+FF+[[F+[[X]-X]-F[-FX]+X]-F+[[X]-X]-F[-FX]+X]-FF[-FFF+[[X]-X]-F[-FX]+X]+F+[[X]-X]-F[-FX]+X]-FFFF+[[FF+[[F+[[X]-X]-F[-FX]+X]-F+[[X]-X]-F[-FX]+X]-FF[-FFF+[[X]-X]-F[-FX]+X]+F+[[X]-X]-F[-FX]+X]-FF+[[F+[[X]-X]-F[-FX]+X]-F+[[X]-X]-F[-FX]+X]-FF[-FFF+[[X]-X]-F[-FX]+X]+F+[[X]-X]-F[-FX]+X]-FFFF[-FFFFFF+[[F+[[X]-X]-F[-FX]+X]-F+[[X]-X]-F[-FX]+X]-FF[-FFF+[[X]-X]-F[-FX]+X]+F+[[X]-X]-F[-FX]+X]+FF+[[F+[[X]-X]-F[-FX]+X]-F+[[X]-X]-F[-FX]+X]-FF[-FFF+[[X]-X]-F[-FX]+X]+F+[[X]-X]-F[-FX]+X]-FFFFFFFF[-FFFFFFFFFFFF+[[FF+[[F+[[X]-X]-F[-FX]+X]-F+[[X]-X]-F[-FX]+X]-FF[-FFF+[[X]-X]-F[-FX]+X]+F+[[X]-X]-F[...