You may copy and paste code from these instructions to save time typing.
Start a new LOGO file
Type:
reset
setpensize 5
Copy the following PROCEDURE:
to snowflake
repeat 6 [fd 20 bk 20 rt 60]
end
Now whenever you want to draw a snowflake, you just have to write snowflake rather than typing all of the code for a snowflake. The code above is called a PREOCEDURE – it teaches the computer a new word and what it means.
Try this
snowflake
repeat 10 [snowflake fd 20 rt 36]
Why did we use the numbers 10 (for repeat) and 36 (for the right turn)?
You can also add a VARIABLE to a procedure. Change the snowflake procedure to this:
to snowflake :size
repeat 6 [fd :size bk :size rt 60]
end
Now when you call snowflake, you need to put a number with it, which will be how big it is.
Try this:
snowflake 50
snowflake 100
You can add other variables to the snowflake too. Change the procedure to this:
to snowflake :size :col :pensize
colour :col
setpensize :pensize
repeat 6 [fd :size bk :size rt 60]
end
Then type for example: snowflake 60 “blue 10
Let’s make a snowstorm…
Copy this code:
repeat 100
[
pu setxy (250 – random 500) (250 – random 500) pd
snowflake random 50 “blue random 15
]
Now tinker, play, experiment…
You could add this after the reset: colour “blue fill then make your snowflakes white