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

MWForum Message [Date Index] [Threads] [Authors] [Attachments] [Subscribe]

[Thread Prev] [Thread Next]

Subject: Re:snowflake
From: mwforum@xxxxxxxxxxxxxxxxxx (Wendy Petti)
Date: Tue, 15 Jul 2003 19:59:50 -0400

Kate, if you send us your MW project as an attachment and/or show us your
code for drawing multiple snowflakes, it would be easier for us to help you
stop the action.

But I've attached one solution and included the code below (sorry - I
didn't bother to add color to it).  It uses the LEVEL slider to set the
number of snowflakes you want to be drawn (beginning with level 1 and
ending with the level set on the slider).  I've removed the question marks
from the LENGTH and LEVEL variables in the SIDE procedure.  (But remember
that (for instance) LEVEL refers to the number on the slider and :LEVEL
refers to the current value of the local variable :LEVEL.  I still think it
would be clearer if they had different names, but this method illustrates
that a slider a local variable can have the same name.)  The number on the
LEVEL slider remains fixed, while the local variable :LEVEL changes with
each recursive iteration in the SIDE procedure as well as in the
KOCH_SNOWFLAKES procedure.  I've added some additional procedures.
Clicking a button called "snowflakes" will activate the turtle to draw each
level of the snowflake up to the number set on the LEVEL slider.

Wendy Petti


to koch_snowflake
seth -90
repeat 3 [rt 120 side length level]
end

to side :length :level
if :level = 0 [fd :length stop]
side :length / 3 :level - 1 lt 60
side :length / 3 :level - 1 rt 120
side :length / 3 :level - 1 lt 60
side :length / 3 :level - 1
end

to koch_snowflake_sequence
seth -90
repeat 3 [rt 120 side length :level]
end

to koch_snowflakes :level
if :level > level [stop]
koch_snowflake_sequence
pu fd length + 20 pd
koch_snowflakes :level + 1
end

to snowflakes
koch_snowflakes 1
end



> -----Original Message-----
> From: mwforum-admin@xxxxxxxxxxxxxxxxxx
> [mailto:mwforum-admin@xxxxxxxxxxxxxxxxxx]On Behalf Of Mikula Family
> Sent: Tuesday, July 15, 2003 5:43 PM
> To: mwforum@xxxxxxxxxxxxxxxxxx
> Subject: [MWForum]Re:snowflake
>
>
> It Works!!! It Works!! I made the sliders and fooled around with
> it - added
> color and it is wonderful. Now - how do you make it stop after a
> specified
> number of shapes? I had it pick up the pen and draw the next one
> beside the
> first. So if you want it to make only 4, how do you tell it to stop?
>

Attachment: koch_snowflake_2.mw2
Description: Binary data


  • Previous by thread: Re:snowflake
  • Next by thread: Almost: snowflake

  • To save an attachment to your computer, PC users should right-click (Mac users, click and hold the mouse button) on the link and then choose 'save target as' from the pop-up menu. A window will then pop up in which you can choose a location for the file.


    © copyright 2001 - 2008