[Squeakland] spiral

Alan Kay alan.kay at squeakland.org
Sat Dec 11 06:23:40 PST 2004


Hi --

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:

foo loopInit
     i <- 1
     foo start script loopBody

foo loopBody
     Test foo's i > 100
        Yes   foo stop script loopBody
         No    mumble
                 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).

Cheers,

Alan

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.
>
>>Phil
>
>-- Shashank
>
>>
>>On Dec 9, 2004, at 6:06 PM, Shashank Date wrote:
>>
>>>Hello,
>>>
>>>Phil Firsenbaum wrote:
>>>
>>>>Randy,
>>>>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,
>>>in eToys?
>>>
>>>Something like "repeat 10 times" (as in Logo)?
>>>
>>>Thanks,
>>>-- Shashank
>>>
>>>
>>>
>>
>
>_______________________________________________
>Squeakland mailing list
>Squeakland at squeakland.org
>http://squeakland.org/mailman/listinfo/squeakland



More information about the Squeakland mailing list