Home Project Folders Resources How Do I? MWForum
Site Map Search Our Team

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


Goal:   Explore spiral variations with embedded recursion.


Screenshot


Code Project Map

to spiral1 :length :pitch
pd
if :length > howbig [stop]
setc whatcolor
setpensize howthick
fd :length rt angle
carefully [note :pitch 3] [ ]
spiral1 :length + howtight :pitch - 1
fd :length lt angle
carefully [note :pitch 3] [ ]
end

to spiral2 :length :pitch
pd
if :length > howbig [stop]
setc whatcolor
setpensize howthick
fd :length rt angle
carefully [note :pitch 3] [ ]
spiral2 :length + howtight :pitch - 1
setc color + 1
fd :length lt angle
carefully [note :pitch 3] [ ]
end

to spiral3 :length :pitch
pd
if :length > howbig [stop]
setc whatcolor
setpensize howthick
fd :length rt angle
carefully [note :pitch 3] [ ]
spiral3 :length + howtight :pitch - 1
rt 180
setc whatcolor + 20
carefully [setpensize howthick - 1] [ ]
fd :length lt angle
carefully [note :pitch 3] [ ]
end

to reset
cg
end



Notes

This project demonstrates three possible variations of the spiral procedure to get interesting effects with embedded recursion.   There are limitless possibilities.



What If?
Try different slider settings with these three variations.


Challenge
Create one or more variations of your own.


On Your Own
Now that you have learned a bit about embedded recursion, create a new procedure with embedded recursion.   It need have nothing to do with drawing spirals.   It could use animation or words, for instance.



© copyright 2001 - 2006  OpenWorld Learning (OWL).   All rights reserved.