The Chaos Game and the Sierpinski Triangle

We usually imagine images that are randomly generated to appear fairly arbitrary, without any noticeable patterns whatsoever. As it turns out, however, randomness can generate structures and patterns with some very interesting characteristics.

There’s a very interesting class of games known as the chaos games, which involve randomness. I won’t go too deeply into the topic here, but I’ll introduce a simple version.

Imagine you have an equilateral triangle, and at each vertex of the triangle, you place a marker. Now, pick a point anywhere on the plane of the triangle. It can be inside the triangle or outside the triangle, doesn’t matter. Then randomly choose one of the 3 markers, and draw a point midway between the marker and the point you picked. Move to the midpoint, and randomly choose one of the markers again and draw the new midpoint. Repeat this process.

 So what happens after several thousand iterations? As it turns out, the Sierpinski Triangle is generated. This is a pretty surprising result, but below is the image after 5000 iterations, from a program I wrote that runs the chaos game iteration:

Here’s a video of the dots being drawn:

Source code

  • Facebook
  • Twitter
  • Tumblr
  • LinkedIn
  • Google Bookmarks
  • Reddit
  • StumbleUpon
  • RSS

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>