alan.kay at squeakland.org
Sat Dec 11 06:23:40 PST 2004
Generally speaking, 5th graders get along very well without a repeat tile
(but more and more older children are using etoys and thus we will include
a loop construct some time this year).
But all the different kinds of loops are easy to make from two scripts, one
to initialize, and one to do the loops and terminate. Use a variable if you
are doing a "for" type loop.
So for player foo, "For i from 1 to 100 do mumble" would be:
i <- 1
foo start script loopBody
Test foo's i > 100
Yes foo stop script loopBody
foo's i increase by 1
This is somewhat cumbersome, but is quite clear about what it does and when
it does it. It has not come up as an issue with 5th graders because they
stuff that we are encouraging them to do has either unbounded looping (the
normal case) or the looping is stopped by some test of an external
condition (as Phil suggested).
At 04:15 AM 12/11/2004, Shashank Date wrote:
>Phil Firsenbaum wrote:
>>If you looked at the script, I have a test which looks to see when
>>Birdie's y coordinate is < 100.
>I did not get the attachment and so could not look at the script. Is the
>script available somwhere on the web?
>>When it is the script is paused and the drawing of the spiral stops.
>>In the running of the project Birdie begins in the center of the screen
>>where its y coordinate is 390. As it moves out from the center y gets
>>larger when it moves towards the top of the screen and smaller when it
>>moves towards the bottom. I arbitrarily chose to look at the value of y
>>when it's approaching the bottom of the screen.
>Oh, I see. I get the idea, but am still not sure how to "arbitrarily"
>choose to look at the value. Are you using the "random" number?
>>Of course, there are other approaches one could take to stop the spiral...
>Yes, and the one I am interested in, is the one which allows us to control
>the number of times a certain script gets executed... a looping mechanism
>if you will.
>>On Dec 9, 2004, at 6:06 PM, Shashank Date wrote:
>>>Phil Firsenbaum wrote:
>>>>I was playing with polygons and spirals last year and created the
>>>>attached scripts. They use a variable (size1) for the length of the
>>>>sides and I start Birdie in the center of the screen.
>>>Is there a way to limit the loops of the spiral to some finite number,
>>>Something like "repeat 10 times" (as in Logo)?
>Squeakland mailing list
>Squeakland at squeakland.org
More information about the Squeakland