Sierpinski Triangles (& other Shapes) - order from chaos **** Uses "The Chaos Game" algorithm to draw **** Click the Green flag to draw the first set of shapes (Sierpiński Triangles initially), drawn by an apparently chaotic algorithm: It picks a random spot on the Stage & draws a spot there. Then goes half-way towards one of the spots marked by the Balls (picked at random) & draws another spot there & keeps doing it over & over again. The result is, quite surprisingly, order from that chaos. After that you can drag the Balls to different spots to draw a slightly different set of shapes, which will be slightly twisted set of the Sierpiński Shapes. In essence what's happening is gradually the drawn dots form replicas of the Shape formed by the Balls. Change Radius, Draw Speed, Dist% & # Balls at will. "Multi?" Button toggles between Single & Multi colours. If # Balls > 3, the "Star?" Button will appear: - If Balls form a Regular Polygon, Click it to form a Star - If Balls form a Star, Click it to form a Regular Polygon It's really only a "Star" shape if # Balls is 10 or 12. Click the stage to switch to a white background when if in single Colour mode the Pen Color switches to Black. Draw Speed (DS) actually changes the number of dots drawn between screen refreshes to DSxDS, so at its minimum value it draws one dot every screen refresh, at its maximum value it draws (45x45) 2025 dots between screen refreshes. Thanks to the suggestion by @Joyoforigami, for a much less grainy/pixelated pen try: https://turbowarp.org/486480829?hqpen
Created by @gregatku for use in Coding Classes for Kids Unlimited, for whom I work as a Coding teacher. Michael Barnsley for inventing the algorithm he called "The Chaos Game" (used by this project) in 1988. @axelisthebest asked me to create this project for him. I refused because last time he made such a suggestion, I got hooked on "Conway's Game of Life", now a life-long obsession, and I didn't need another one. So @axelisthebest made it himself and thereby got me hooked anyway. Originally, I didn't change any of his code, I just made it draw faster and more fun to play around with. But when Axel suggested I make it capable of drawing different shapes by changing the number of Balls, I had to completely rewrite the code. I am hoping Axel likes what I've done to his Project. Well he must have, because he remixed my remix, and showed me how to make many different fractals by changing the Distance % towards the next Ball you move, to suit the # Balls you have. So now you can change that as well, although when you change the # Balls, the project initially sets Dist% to a % that I think makes a nice pattern to start with, but you can change it any time after that. Axel was inspired by this Numberphile video (youtu.be/kbKtFN71Lfs). Changing the # Balls completely changes the Shapes drawn and more importantly needs a different Rule, for where to draw the next Spot. The images this project draws are slightly different to the ones shown in the Numberphile video referred to above. I discovered that the "half-way" Rule used for the Triangles doesn't produce anything like what the Numberphile video for a larger number of Balls does, so the Rule they used had to be different, but they don't say what that Rule is. But thanks to @axelisthebest showing me (via his remix of this project), it's clearly just moving a different % of the distance to the randomly picked Ball. So now you can control that too. A more recent update gives you the option to draw in either Single or Multiple colours. In the Multi-colour rendition, each Dot is drawn in a colour associated with the random Ball (vertex) we are moving towards. The most recent update gives you the option to move every second ball (if # Balls > 3) inwards to form star-like patterns, using the "Star" button. The only real "star" patterns formed are the Pentagram (# Balls = 10) and the Hexagram (# Balls =12). The distance every 2nd ball is moved in, is half-way, except for the Pentagram & Hexagram, each of which is calculated specifically to form that shape. The mathematical formula for the Hexagram was given directly here: https://mathworld.wolfram.com/Hexagram.html while the one for the Pentagram was derived from information provided here: https://mathworld.wolfram.com/Pentagram.html