Page 2: Fractal Art
Unit 3, Lab 1, Page 2
In this project, you will nest repeat
blocks inside repeat
blocks to generate complex pictures.
-
“U3L1-FractalArt”
-
Build a script that draws a red triangle, duplicate it twice, modify one copy to draw a blue triangle half the size of the red, and modify the other copy to draw a green one half the size of the blue.
-
To duplicate a script, right-click (or control-click) on the first block of the script (in this case, the
repeat
block) and choose “duplicate”. - Then change the inputs.
-
To duplicate a script, right-click (or control-click) on the first block of the script (in this case, the
- Try each script by itself to be certain what it does. Then clear the stage.
-
Predict what will happen when you insert the entire script for the blue triangle between the
move
andturn
blocks of the code for the red triangle:
- Then build it to see what it does.
-
How many times does the
move 50 steps
instruction run and why? -
Using the scripts you have, find a way to make this picture. Use Visible Stepping to help you work out any bugs.
- If you like, embed one more triangle, half the size of the last one, in the same way.
-
Examine this code without running it:
- Predict how many blue shapes it will draw.
- Try to sketch what it will produce.
- If one more copy of the basic script were embedded inside the blue, how many copies of that shape would be drawn?