Barnsley Fern — Chaos Game
Same trick as the Sierpinski triangle — pick a random rule, apply it, plot a dot —
but here the four rules are weighted affine transforms that sculpt a lifelike fern.
Start
Restart
Pause
Skip to Full Fractal
Manual speed
1
How it works: same chaos-game idea as the Sierpinski triangle, but
instead of 3 equally-likely "jump toward a corner" rules, the fern uses 4 weighted
affine transforms — each a matrix multiply plus offset, (x,y) → (ax+by+e,
cx+dy+f). One rule (picked 85% of the time) draws a leaflet, shrinking and
rotating it slightly, which is what builds the self-similar frond pattern; two more
rules (7% each) generate the left- and right-curving leaflets branching off the stem;
the last rule (just 1% of the time) draws the short base stem segment that anchors the
whole plant. Every single dot only depends on the previous one and a coin flip, yet
because the transforms were hand-tuned by Michael Barnsley to mimic how real ferns
grow — each frond a shrunk, rotated copy of the whole — the same recognizable fern
emerges no matter the random seed.