Midpoint jumpsOur first challenge is to get the turtle to jump halfway from where it is standing to a target point. For this, we recall the getxy() function and use the xy-coordinates for the screen (the home where the turtle starts is (0, 0) in this system). Here's an example:
Sierpinski TriangleUsing this basic code, we can reorganize things a bit to play the Chaos Game and generate an amazing picture. In each iteration, we randomly select one vertex, then jump halfway to that vertex, leave a dot, then continue:
This version already has a nice little twist with the random colors on each new dot. Nice!
HomeworkFinish the challenges from the class (including writing explanations of the lines of code we highlighted) and then modify the last program to create your own picture. Here's an example of something I created:
A slightly different version is here: <a href="https://jgplay.pencilcode.net/edit/Math/Fractal3">more Fractals.</a>