Marks
Copies
Similarity dimension
Measured dimension

More information about the chaos game

Chaos game

Put three dots on a page, the corners of a triangle. Start anywhere, roll a die to pick a corner, move halfway towards it and make a mark. Roll again, move halfway again, mark again. After a few thousand rolls the marks do not lie in a random cloud: they draw the Sierpiński triangle, sharp to the smallest detail. Change the corners, the jump or the rules and the same game draws a carpet, a cross, a five-pointed flake or shapes nobody has named. Start anywhere, roll a die to pick one of the targets, jump part of the way towards it and mark the spot, then do it again. Press Play and watch a fractal appear out of chance, or One jump to see a single roll and jump. Pick a preset, or set the corners, extra targets in the centre or on the edges, the jump and a rule that forbids some jumps. Drag a target to move it. Colour by copy paints each mark in the colour of the target it jumped to, and every colour turns out to be a small copy of the whole shape.

How it works

  1. Press Play to roll and jump thousands of times a second, or One jump to watch a single roll: the dashed line runs to the target the die picked and the new mark is ringed.
  2. Pick a preset, or set the corners, add the centre or the midpoints of the edges as extra targets, change the jump and choose a rule that forbids some jumps.
  3. Drag a target to move it and watch the whole fractal bend with it; colour by copy to see every target's scaled copy of the whole shape.
  4. Read the copies and their scale, the similarity dimension and the dimension measured by box counting in the tiles, then save the picture or open it in the editor with one layer per copy.

Order out of chance

Every jump halfway towards a corner shrinks the whole picture towards that corner by half. The Sierpiński triangle is exactly the shape that is made of three such half-size copies of itself, one at each corner, so once a mark lands on it, every later mark stays on it. And wherever the game starts, each jump halves the distance to the triangle, so after a dozen jumps the marks are closer to it than a pixel. The die decides only in which order the triangle is drawn, not what is drawn.

Carpets, crosses and flakes

With the four corners of a square and the four midpoints of its edges as targets and a jump of 2/3, the game draws the Sierpiński carpet: eight copies at a third of the size. Four corners and the centre draw the Vicsek cross. Five corners and a jump of 1/φ ≈ 0.618 draw the pentaflake, where five copies just touch; six corners and the centre draw the hexaflake. A jump that is too short makes the copies overlap and the marks fill a solid patch; the tile then says so.

Rules that forbid some jumps

A square with a jump of 1/2 is dull: the marks fill it evenly. Forbid the die to pick the same corner twice in a row and a lacy fractal appears; forbid the corner one step clockwise of the last and the square breaks into four spiralling arms. On a pentagon, never picking a neighbour of the last corner draws a five-pointed star full of smaller pentagons. Such restricted games no longer make simple copies, so there is no formula for their dimension, but box counting still measures it.

Two ways to the dimension

A shape made of N copies of itself, each scaled by s, has the similarity dimension log N / log(1/s): log 3 / log 2 ≈ 1.585 for the Sierpiński triangle, log 8 / log 3 ≈ 1.893 for the carpet. That holds as long as the copies do not overlap. Box counting measures the dimension from the marks themselves: lay grids of 16 to 256 boxes a side over the picture, count the boxes that hold a mark, and read the dimension from how fast the count grows as the boxes shrink.

Frequently asked questions

What is the chaos game?

A way to draw a fractal with a die. Pick some targets, such as the corners of a triangle. From any starting point, roll the die to choose a target, move a fixed fraction of the way towards it and mark the spot, then repeat. Michael Barnsley gave it the name in his 1988 book Fractals Everywhere. With three corners and a jump of one half, the marks draw the Sierpiński triangle.

Why does a random process draw such a regular shape?

Each jump towards a target shrinks the plane towards that target by the same factor. The fractal is the one shape that is made of those shrunken copies of itself, so a mark on it always lands on it again, and a mark off it gets closer with every jump. The randomness only decides the order in which the points of the fractal are visited. Colour by copy shows it: every colour is the copy of the whole shape at one target.

What does the jump do?

It is how far each move goes towards the chosen target: 1/2 means halfway. Every copy of the shape is then scaled by one minus the jump, so a jump of 1/2 gives half-size copies and a jump of 2/3 gives copies a third of the size. If the jump is too small for the number of targets, the copies overlap and the marks fill a solid area instead of a fractal.

What do the rules change?

They forbid some choices depending on the last one: never the same target twice, never a corner next to the last corner, never the corner one step clockwise, or never the opposite corner. On a square, where the free game fills everything, these rules carve out fractals. Their shapes are no longer simple copies of the whole, so the similarity dimension tile shows a dash and only the measured dimension is given.

How is the fractal dimension measured?

By box counting. The app lays grids of 16, 32, 64, 128 and 256 boxes a side over the picture, counts the boxes that contain at least one mark, and fits a line through log(count) against log(boxes per side). The slope is the dimension. It needs a few thousand marks; with a million marks it comes within a few hundredths of log 3 / log 2 ≈ 1.585 for the Sierpiński triangle.

Can I use the picture in a design?

Yes. Save gives a PNG at the size you choose, and the pencil opens the picture in the PictorX photo editor with every copy on a layer of its own, plus the targets, so you can recolour or hide copies one by one. In the editor itself it is under Apps ▸ Fractals ▸ Chaos Game. Everything is computed in your browser.

Chaos Game: how do I record a video?

Press the red Record button in the playback bar: it films what the stage shows. Press it again to stop, and the video is saved to your device. Recording is free; you only need to sign in. Without a subscription the video carries a small PictorX logo in a corner. The button beside Record opens the video options: the shape (as shown, square, story 9:16 or wide 16:9), the length (until you stop, or 5, 10, 15 or 30 seconds for social media) and the file: MP4, WebM or an animated GIF. You can add one of three music tracks: calm, bright or beat.

Ready to try it?

Open PictorX in your browser — no install, no credit card required to start.

Go to Editor