Step 12
Capstone 2: boxes and blocks
New to lesson cards? See what a lesson card is.
In the first capstone you put a loop, random and an if and else into one piece of art. Since then you have learned three more tools. A variable (a box) keeps a number and can change it. A block of your own is a word you teach the turtle. And a loop can go inside another loop.
In this capstone you use them together in one picture that is yours. Nobody will make the same one, because you choose what the box holds, what your block draws, and how it all repeats.
What you will build
A picture with these in it:
- A block of your own that has an input, and that your program uses more than once.
- A variable (a box) that changes while the program runs, so something grows, shrinks or fades.
- A loop that repeats.
- At least two colors.
- A sticky note on the page that says what it all does, in your own words.
The list at the end of this page shows what to check.
Pick a theme
Choose one, or invent your own.
- Growing garden. A
flowerorpetalblock with asizeinput. A loop uses it again and again, and a box makes each one bigger than the last. - Rainbow spiral. A block draws one side or one square. A box grows each lap to make the spiral wider, and the color is made from the box, as in Step 10.
- Tower of shapes. A block draws a shape with a
sizeinput. A loop stacks the shapes up, and a box makes each one smaller than the one below.
Plan it
Sketch on paper what you imagine the finished picture looks like.
Then finish these three sentences:
- My box holds __, and it changes by __ each lap.
- My block is called __. It draws __, and its input is __.
- My loop repeats __ times and uses my block __ time(s) each lap.
If you can fill in all three, you are ready to build. If you cannot, go back to your sketch.
The shape of your program
Every capstone has this shape. Your job is to decide what goes in the gaps.
to (the name of your block) (an input)
(blocks that draw one part, using the input)
start
clean
store in box1: (a number to start with)
repeat (how many times?)
(use your block, giving it box1)
(change box1: add, subtract, multiply)
(turn or move, and maybe set a color)
Build it
Build in small pieces and run after each one:
- First make your block work on its own. Use it once with a plain number, and check the drawing is what you meant.
- Then put it inside a
repeat, still with a plain number. - Last, put
box1where the plain number was, and add the block that changesbox1every lap. Remember it goes inside therepeat.
If your picture is slow to draw, add a speed block (Flow palette) near the top. Speed 4 is instant.
Check yourself
Before you save, check that:
- Your picture has a block of your own with an input, and your program uses it more than once.
- You can watch the box change: the yellow strip changes, and so does the picture.
- Your picture has a
repeatthat draws part of it. - Your picture has at least two colors.
- Your sticky note has your name. It says, in your own words, what your box, your block and your loop each do.
Make your PDF
Add the sticky note: open the Notes palette, drag out a note, tap it and type. A sticky note holds about 300 letters, so keep it short.
The Notes palette also has a write block. Leave it out of this one, so the picture comes from your box, your block and your loop.
Then press the PDF button. Your blocks, your note and your drawing are on the first page. The last page lists what your program is made of, with a count of each kind of block: variables, loops, blocks you made, and more. Look at it. Does it match what you meant to build? Keep your PDF. If you share this computer, press New when you are done so the next person starts fresh.
Done early?
A loop inside a loop. Put your block inside an inside loop, and put that inside an outside loop, so the box makes a whole ring of shapes grow. Work out the outside turn first, so the ring closes.