Eliminating Chaos

Objective

After completing this lesson, you will be able to implement a simple algorithm that results in interesting emerging patterns.

Content

Video summary:

The video shows how to build a complex system from simple blocks by implementing the chaos game in Snap: create a reusable "dot" block, use three sprites as triangle vertices, repeatedly pick a random vertex, set it as a target variable, move half the distance toward it and draw a dot — running this in a loop (and turbo mode) produces the emergent Sierpinski triangle. It highlights the very basics of object-oriented programming, and how simple rules produce complex patterns.

Key points:

  • Build a reusable dot block (parameterized pen size) to draw points.
  • Use three sprites as triangle vertices and pick a random one from my other sprites.
  • Store the chosen vertex in a variable, point toward it, move half the distance, and draw — repeat forever.
  • Running fast (turbo mode) reveals the emergent Sierpinski fractal; object-oriented use of sprites makes the system easy to modify.