Project Folders
Teacher Resources
Student Resources
How Do I?
Site Map
Our Team

spirals 1 2 3 4 5 6 7 8 9
Spirals 2
5 KB

Goal:   Change a slider´s setting as a spiral grows.


Vocabulary:   repeat, set, carefully, announce

Project Map

to square-spiral
carefully [repeat 12 [fd howlong rt 90 sethowlong howlong + 5]]
[announce [The slider can't go any higher!]]

to reset


This project draws 12 lines of increasing length while the turtle turns right 90 degrees after drawing each line.   The lines repeat and the turning angle stays the same, but the lengths vary.

  1. Make a slider and name it howlong.   Set its minimum to 5 and its maximum to a large number such as 300.

  2. In the square-spiral procedure, repeat 12 means, "Repeat the instruction list 12 times."

    Fd howlong means, "Move forward the number of turtle steps on the howlong slider."

    Sethowlong howlong + 5 means, "Set the howlong slider 5 numbers higher than it is currently set."  

  3. But we need to be careful, because we cannot set the slider higher than its maximum.   This would produce an error message.   We can place the sethowlong command inside of a carefully command to avoid an error message.

    Carefully means, "Run the first input (a word or list of instructions).   If there is an error, stop and run the second input (a word or list of instructions).   If there are no errors, fine; ignore the second input."   So in this case, if sethowlong exceeds the maximum on the howlong slider, the slider will stop at the maximum and we will see a message.

    Announce displays the message in an alert box.

  4. Drag the slider back down to a small number before you start creating each new spiral.

What If?
Try clicking the button again after the turtle draws the spiral.   Click it five times.  

Can you make a tighter spiral (with lines closer together)?

On Your Own - Project Ideas
Can you revise the procedure so that with one button click the page becomes filled with one large twisting spiral?

© copyright 2001 - 2016  OpenWorld Learning.   All rights reserved.