Press the green flag to start and turn on Turbo Mode by holding down on “Shift” and clicking the green flag at the same time. You can also drag the red, green, and blue circles around or use the space bar to randomize their location. Press any key to start over the process. Have fun! Click “See inside” if you want to see how the action is coded! If you liked it, please love, favorite, and follow! And please send your feedback in the comments! It’s very helpful! :D
This way of generating the Sierpiński triangle is called the chaos game. Wait, what is the Sierpiński triangle? After a while, can you see that the result, an approximation of the Sierpiński triangle, looks like it is made out of three mini–Sierpiński triangles? And each mini–Sierpiński triangle is made out of three… mini–mini–Sierpiński triangles? And each—I think you get the pattern. This makes it a fractal! A fractal has a fractional dimension. You see, a line is made out of 2 mini-lines that are twice as small, right? And a square can be constructed from 4 mini-squares, and a cube can be constructed from 8 mini-squares. So, a line has log_2(2) = 1 dimension, a square has log_2(4) = 2 dimensions, and a cube has log_2(8) = 3 dimensions. So, the Sierpiński triangle must have log_2(3) ≈ 1.585 dimensions. I know, it’s complicated and interesting!