Anchor G Anchor R Anchor B 1. Start point

The chaos game is a game that starts with a series of anchor points. There could be any number of anchor points in any orientation. We'll start with three points, marked as Anchor R, G and B respectively.

We'll also place a point somewhere on this canvas within these three anchors. This point is labelled 1.

Now we'll take a regular die and colour in two of the faces red, two of them blue and two of them green.

We'll roll this die to select one of the anchor points.

Anchor G Anchor R Anchor B 1. 2. New start point

We've rolled the die, and it's come up green. We've chosen Anchor G.

We'll draw a line from the start point 1. to the Anchor G and then draw a new point, labelled '2', halfway along this line.

This is now the start point for the next iteration.

Now we randomly choose another anchor point.

Anchor G Anchor R Anchor B 1. 2. New start point 3.

This time it's come up red, we've chosen Anchor R.

We'll draw a line from the point 2 to the red anchor and then draw a new point halfway along that line.

We roll the die again and this time it comes up blue

Anchor G Anchor R Anchor B 1. 2. 3.

We draw the line from point 3 to the green anchor and draw a new point halfway between them again.

We can keep doing this over and over again, randomly selecting one of the three anchor points, and drawing a point halfway between that anchor and the point we drew previously.

But why? You may well think this will just result in a random collection of points across the canvas.


Iterations
Radius Speed

If we perform enough iterations, a remarkable structure emerges out of the random chaos.

The points form the SierpiƄski triangle. This is one of the most basic geometric fractals.

The animation shows 1,000 iterations of the chaos game. The more iterations we perform, the more defined this structure becomes.

It doesn't matter where we placed that initial point, it could even have been far outside the three anchors. This game will always produce the same structure.


Here is the final image after about 1,000,000 iterations, with slightly smaller data points, and here is a video.

A note on the colouring; when a new point is drawn, I also select the r,g,b values that are halfway between those of the start point and the anchor point. This results in a nice colour gradient on the structure.

We're not limited to only three anchor points. The next section explores a few other polygons.