What you are looking at
Mark the corners of a triangle. Put a dot anywhere — genuinely anywhere, it does not matter. Now repeat forever:
- Pick one of the three corners at random.
- Move to the point halfway between where you are and that corner.
- Mark it.
Every single step is a coin toss. There is no memory, no plan, no geometry beyond "halfway." And what appears is the Sierpiński triangle, perfectly, to whatever resolution you care to compute — a shape defined by removing middle triangles infinitely often, arrived at by rolling dice.
The reason is that the picture is not being drawn; it is being revealed. The three "move halfway to a corner" maps are contractions, and a set of contractions has exactly one compact set that maps onto itself — its attractor. The Sierpiński triangle is that set. Any starting point is pulled toward it exponentially fast (after ten steps you are within a thousandth of it), and the random walk then wanders around inside it forever, dense in the attractor because your sequence of coin tosses eventually contains every finite pattern. The randomness is only there to guarantee you visit everywhere. It contributes nothing to the shape.
Colour each point by which corner you jumped to and the mechanism becomes visible: the picture is three shrunken copies of itself, and the colours are the copies.
The number to turn is the contraction: how big each copy is relative to the whole. "Halfway to the corner" is a contraction of 1/2, and for a triangle 1/2 is exactly the value at which the three copies meet corner to corner without overlapping. Change the corner count and that critical value changes with it. Five corners at 0.382 gives the Sierpiński pentagon. Six at 1/3 gives a snowflake. Four at 1/2 gives a solid square — there the copies tile the whole thing exactly, so nothing is left out — but four at 1/2 with the rule "never pick the same corner twice in a row" gives a fractal again, because you have deleted part of the address space.
Try this
- Three corners at 0.5 for the classic. Then drag the contraction to 0.45 and watch the triangle come apart into three separate clumps, and to 0.55 and watch the holes fill in. 0.5 is the exact boundary.
- Press Just touching at any corner count. It sets the contraction to the unique value where the copies meet but never overlap: 1/2 for a triangle, 0.381966 for a pentagon, 1/3 for a hexagon, 0.257772 for nine. The readout shows the exact figure beside the one you are using.
- Four corners at 1/2 is a boring grey square. Now set the restriction to Never the same twice. A fractal appears out of nowhere — and it was there all along, hidden under the parts of the square you were only reaching by repeating yourself.
- Set corners to 9 and press Just touching, for the house fractal. Its similarity dimension is about 1.62.
- Press Reroll for an entirely different sequence of dice. The picture does not change. That is the whole point — a quarter of a million different random walks all draw the same shape.
Notes
Michael Barnsley named the chaos game in Fractals Everywhere (1988) and used it as the constructive half of a bigger idea: an iterated function system. Write down a handful of affine maps, and their attractor is a fractal. Run the maps forward at random and you draw it. Barnsley's fern — five maps, one of which is nearly degenerate — is the famous example, and it compresses a photorealistic frond into about twenty numbers.
That compression is the real claim. The collage theorem says that if you can cover a shape with small distorted copies of itself, the IFS built from those copies has an attractor close to your shape. For a while in the late 1980s this looked like it might become a general image compression scheme. It did not, quite — the encoding side is brutally hard, and the discrete cosine transform got there first — but the underlying observation survived: some very complicated pictures have very short descriptions, and the shortness is the interesting part.
The just-touching ratios come from a single formula. For a regular n-gon the copies meet without overlapping when the ratio is 1 / (2(1 + Σ cos(2πk/n))), summing k from 1 to ⌊n/4⌋. It gives 1/2 for the triangle and the square, 1/φ² for the pentagon, 1/3 for the hexagon, and 1 − √2/2 for the octagon.
Further reading
Michael Barnsley, Fractals Everywhere (Academic Press, 1988). Wacław Sierpiński's original 1915 note describes the triangle by deletion, sixty years before anyone thought to roll dice at it.