Fractal Art

In this project, you will nest repeat blocks inside repeat blocks to generate complex pictures.
Red triangle with blue children and green grandchildren
  1. "U3L1-FractalArt"Create a new project called U3L1-FractalArt
  2. 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.
  3. Try each script by itself to be certain what it does. Then clear the stage.
  4. Talk with Your Partner Predict what will happen when you insert the entire script for the blue triangle between the move and turn blocks of the code for the red triangle:
    repeat (3) {set pen color to (red); move (100) steps; repeat (3) {set pen color to (blue); move (100) steps; turn clockwise (120) degrees}; turn right (120) degrees}
  5. Pair Programming Swap
  6. Then build it to see what it does.
  7. Talk with Your PartnerHow many times does the move 50 steps instruction run and why?
  8. Using the scripts you have, find a way to make this picture. Use Visible Stepping to help you work out any bugs.
    Red triangle with blue children and green grandchildren
  9. Save Your Work
  1. If you like, embed one more triangle, half the size of the last one, in the same way.
  2. Examine this code without running it:
    repeat{set pen color to (red); move(100) steps; repeat(4){set pen color to (blue); move (50) steps; turn clockwise(90) degrees}; turn clockwise(90) degrees}
    1. Predict how many blue shapes it will draw.
    2. Try to sketch what it will produce.
    3. If one more copy of the basic script were embedded inside the blue, how many copies of that shape would be drawn?