O'Reilly logo

Tkinter GUI Application Development Blueprints - Second Edition by Bhaskar Chaudhary

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chaos game – building triangles out of randomness

The Chaos game refers to the emergence of fractal patterns with random numbers when the selection of random numbers are subject to some constraints. Let's look at the rules of one of the simplest chaos games:

  1. We start by creating three points on a plane to form a triangle. 
  2. To begin the game, we draw a random point inside the triangle.
  3. We then roll a dice. Given the outcome, we move halfway between the last point and any one of the vertices of the triangle. For example, if the outcome is 1 or 2, we move halfway between the last point and vertex A. If the outcome is 3 or 4, we move halfway from the current point towards vertex B, or if the outcome is 5 or 6, we draw the next point halfway ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required