Chaos Game -- 2 Dimensions

Chaos Game: Two Dimensions

Note: Please adjust width of browser if only one column is visible.
[Click here for another Shiny app on the Chaos Game]

In the two dimensional version of the Chaos Game we start with a regular polygon and mark selected points which will typically be the vertices. These points will be called endpoints and will be marked in red. The game begins by randomly choosing a starting point and one of the endpoints. Mark a new point at a fixed distance ratio from the starting point to the endpoint (e.g., halfway to the endpoint). Select another endpoint at random and, with the most recently created point, repeat the process to generate the next point and continue. By applying the right distance ratio the resulting set of points can converge to a beautiful image known as a fractal . For each polygon the required distance ratio to yield a fractal will be provided, but try different settings to see what other patterns may arise!


For Triangle default value is 0.50
For Square default value is 0.67 (2/3)
For Pentagon default value is 0.63 (5/8)
For Hexagon default value is 0.67 (2/3)
For Tetrahedron default value is 0.50
For Cube default value is 0.33
For Dodecahedron default value is 0.38

Press the button above to animate.
Advance slider manually at anytime.
Click Randomize to re-randomize at current n.
Press the button above to animate.
Advance slider manually at anytime.
Click Randomize to re-randomize at current n.
Press the button above to animate.
Advance slider manually at anytime.
Click Randomize to re-randomize at current n.

Click Randomize to re-randomize outcomes based on current settings.

Shiny app by Jimmy Doi
Base R code by Jimmy Doi
Shiny source files: GitHub Gist
Cal Poly Statistics Dept Shiny Series

This plot shows a step-by-step progression of the chaos game. At each step the randomly chosen red endpoint will be marked. Use the 'Number of points' slider and press the button to animate the plot. Advance the slider to n=100 before moving to the 'Extended Sequence' tab.


Compare the plot above when n=100 to the plot when n=100 from the 'Initial Sequence' tab – they should be identical. This shows the plot given above is simply a continuation of the chaos game. Advance the 'Number of points' slider to n=1000 before moving to the 'Complete Sequence' tab.


Compare the plot above when n=1000 to the plot when n=1000 from the 'Extended Sequence' tab – they should be identical. This again shows the plot given above is a continuation of the chaos game. Smaller plotting points are used to reveal the finer details of the completed plot.