The Chaos Game is a method of creating fractals using a polygon and a point that moves between the vertices of that polygon.


Sierpinski triangle       Sierpinski carpet       Sierpinski pentagon

The point starts at any position and continuously jumps towards a random vertex by a determined factor, drawing wherever it lands. To generate the Sierpinski triangle, the point jumps towards 1 of the 3 vertices at random by a factor of 1/2. The Sierpinski carpet requires additional vertices at the midpoints of the four edges and jumps between these vertices by a factor of 2/3. The Sierpinski pentagon is generated by jumping between the 5 vertices by a factor of 1/phi.


  • Z - Pause/Resume
  • X - Cycle through fractal shapes
  • Left/Right - Change color mode
  • Up/Down - Change speed

If you found this interesting you might also like my recreation of Conway's Game of Life.


Windows version 1 MB
Linux version 687 kB
Mac version 3 MB
Raspberry Pi version 1 MB

Development log

Leave a comment

Log in with to leave a comment.