Help with morph and world refresh

Stephane Ducasse ducasse at iam.unibe.ch
Sat Apr 5 12:16:00 UTC 2003


Hi bob

I want to implement a robot a la Karel that novices can program.
Using the step mechanism for that is not clear for me because the idea 
is that kids
can define any kind of method in terms of the simple elementary one. So 
I have everything working except this problem with the refresh of the 
world.

I have to  think about your solution with the calculatePositionAt:

On Saturday, April 5, 2003, at 01:45 PM, Bob Arning wrote:

> On Sat, 5 Apr 2003 10:37:01 +0200 Stephane Ducasse 
> <ducasse at iam.unibe.ch> wrote:
>> I have the impression that this is a really bad practice to explicitly
>> wait for the refresh but I do not know how to do it in a better way.
>>
>> Have you suggestion to fix my problem?
>
> It sounds as if you really want to slow the robot down to some sort of 
> "realistic" rate of progress so that you can actually see it doing 
> stuff. The morphic approach would be to use a #step method...
>
> step
>
> 	position _ self calculatePositionAt: Time millisecondClockValue.
> 	self goTo: position.
> 	self canPick ifTrue: [self pick].
>
> and make this run as often as possible...
>
> stepTime
>
> 	^1
>
> Cheers,
> Bob
>
>
>
Prof. Dr. Stéphane DUCASSE
http://www.iam.unibe.ch/~ducasse/
  "if you knew today was your last day on earth, what would you do 
different? ...  especially if,
  by doing something different, today might not be your last day on 
earth" Calvin&Hobbes

"The best way to predict the future is to invent it..." Alan Kay.

Open Source Smalltalks: http://www.squeak.org, 
http://www.gnu.org/software/smalltalk/smalltalk.html
Free books for Universities at 
http://www.esug.org/sponsoring/promotionProgram.html
Free Online Book at 
http://www.iam.unibe.ch/~ducasse/WebPages/FreeBooks.html



More information about the Squeak-dev mailing list