Chaos Game

Building Sierpinski’s triangle with the chaos game.

The chaos game is a simple experiment which creates a skewed version of Sierpinski’s triangle—also known as the Sierpinski gasket—between three chosen points. The Macromedia Flash animation shown here is a real-time calculation and rendering of this game between three user-selected points. The rules of the chaos game are relatively simple:

  1. Start with a blank canvas;
  2. Choose three random “base” points on this canvas, labelling each of them one, two and three respectively;
  3. Pick an arbitrary point on the canvas, calling it the “game point”;
  4. Choose a random number between one and three (using a die or any other random number generation technique);
  5. Draw the new game point halfway in between the previous game point and the base point corresponding to the chosen random number;
  6. Repeat from step 4.
Macromedia Flash player required.

The number at the top of the Macromedia Flash animation is the total number of game points that have been drawn. Though the underlying ActionScript is relatively simple, the results obtained are very interesting.

Plaintext source of this program, released under the GPL.