DB

Chaos Game

My introduction to the "Chaos Game" was from the excellent Youtube channel Numberphile

The premise is fairly simple. Draw three points on a canvas. We will also start with an initial point at the center of the three points. With each iteration of the "game" we will do as follows.

  1. Choose randomly one of the three dots.
  2. Draw an invisible line from the the last point you made (in the first iteration this will be from the center) to the dot you chose in step 1.
  3. Draw a point at the midpoint of this line. This is your new point.

You can run the code below which will iterate this process once every five seconds to give you an idea how it works. Maybe pretend you haven't seen the icon so you don't know what's happening next!

So the question is, what would happen if you ran the process hundreds of times? Would the dots spread out randomly throughout the circle? Seems likely that they would.

But of course you've seen the icon. They do not! Check out the sped up version. Sierpinski's Triangle!

For more information about the Chaos Game check out the Wikipedia page. Try playing with the variables. Do you still get a fractal if you start with more than three points? (Hint: You do, but you can't bisect the line anymore, you'll have to play with the weights).