To use this project, you need the free MicroWorlds Web Player, but you do not need to know anything about MicroWorlds.
You can draw multi-sided spirals or nesting polygons with this project. The screenshot shows a small nesting hexagon, drawn with the angle set to 60, and a larger spiral drawn with the angle set to 46. (The angle is the number of degrees that the turtle turns after drawing each line segment.)
If you own MicroWorlds and would like the create the project yourself from scratch, here are the procedures:
* * * * * * * * * *
procedures for POLYGONMAKER
Please refer to the screenshot to see the buttons, sliders, textbox and turtles needed. The green and red "buttons" are turtles programmed with procedure names and values:
spiral 3 or polygon 3.
* * * * * * * * * *
to spiral :length
text1, hidetext
t1, pd
if empty? angle [announce [Click in the angle box and
type a number. Then click "Draw a spiral" again.] stop]
if :length > size. [pu stop]
fd :length
rt angle
spiral :length + spacing
end
to reset
clean
t1, pu setpos [60 0] seth 0
angle, ct
end
The polygon procedure works just like the spiral procedure. Aside from the name, only one line is different. Instead of rt angle, we need the repeat command. The / sign is the division symbol. For instance, if our angle is 120, we repeat the command 360 / 120 times, or 3 times. If our angle is 121, we get a slight twist as we draw successive polygons.
to polygon :length
text1, hidetext
t1, pd
if empty? angle [announce [Click in the angle box and
type a number. Then click "Draw a polygon" again.] stop]
if :length > size. [pu stop]
repeat 360 / angle [fd :length rt angle]
polygon :length + spacing
end
to show.instructions
text1, showtext
end
to hide.instructions
text1, hidetext
end
to startup
reset
show.instructions
end
|