Free course · Module II · Dimension and construction · Lesson 12 of 21 · about 12 minutes

The chaos game

In this lesson you will
  • Run the random iteration algorithm
  • Explain why it draws the attractor
  • Understand the role of the probabilities

Drawing an attractor by applying the Hutchinson operator to whole shapes is slow. The chaos game, popularised by Michael Barnsley, is faster. Start with any point. At each step pick one of the IFS maps at random, apply it to the current point and plot the result.

For the Sierpiński triangle the rule is simple: choose a corner at random and jump halfway towards it. After a few thousand jumps the triangle appears. The randomness does not matter, because every map pulls the point toward the attractor, and with probability 1 the sequence of choices eventually visits every part of it.

The first few points are usually not plotted, since the starting point may lie off the attractor and needs a few steps to land close to it.

The probabilities assigned to the maps change how densely each part fills in, not the final shape. For the Barnsley fern they are 1%, 85%, 7% and 7%. The largest map gets the highest probability so that the main frond does not look sparse.

Key terms chaos game random iteration algorithm transient points map probabilities

Try it live: Play the chaos game in the chaos game section →

Lesson quiz

  1. In the chaos game for the Sierpiński triangle, how far does the point jump towards the chosen corner?

    • A quarter of the way
    • Halfway
    • Two-thirds of the way
    • All the way
    Show answer

    Halfway. The jump ratio 1/2 matches the scale factor of the three maps.

  2. Why are the first few points usually not plotted?

    • They are always wrong
    • The starting point may be off the attractor
    • They slow the program
    • They are plotted twice
    Show answer

    The starting point may be off the attractor. The orbit needs a few steps to get close to the attractor.

  3. Changing the probabilities of the maps changes…

    • The shape of the attractor
    • How densely each region fills in
    • The number of maps
    • The dimension
    Show answer

    How densely each region fills in. The attractor is the same; only the distribution of plotted points changes.

Take this quiz interactively and save your progress (free) →