alice-teacher Alice 3.1 World code needed (similar to Greenfoot.stop)

Grim, Dianne Dianne.Grim at vernonct.org
Tue Nov 11 11:49:46 EST 2014


Thank you Don!
Yes, the intent is to stop the animation, aka the game.  I will give it a try and let you know the results.
Best to you,

Dianne K.L. Grim, MEd
Rockville High School
Computer Science Dept.
860-870-6050  x131

________________________________________
From: alice-teachers-bounces+dianne.grim=vernonct.org at lists.andrew.cmu.edu [alice-teachers-bounces+dianne.grim=vernonct.org at lists.andrew.cmu.edu] on behalf of Don Slater [dslater at andrew.cmu.edu]
Sent: Tuesday, November 11, 2014 11:18 AM
To: Alice Teachers
Subject: Re: alice-teacher Alice 3.1 World code needed (similar to      Greenfoot.stop)

Dianne,
By automatically end, do you mean that the playback window automatically closes and you return to the IDE? Alice does not have that type of command.

If however, you want the animation to stop, but you are not sure exactly when that should happen, then why you might do is create a boolean variable, such as programIsRunning and set it to true. Then create a while loop that controls program execution, with the test condition for the loop being

        while (programIRunnning)

and then set the variable to false when the queen is oriented to the hole.

You could also use this variable to control execution of any events that you may be using, with an if statement testing the programIsRunning variable to fire the event, or not.

Let me know if this does not answer your question…

All the best,
Don Slater

> On Nov 11, 2014, at 9:49 AM, Grim, Dianne <Dianne.Grim at vernonct.org> wrote:
>
> Is there a piece of code that will enable the Alice 3.1 program to know when to end?
> Example:
> The queen is chasing the rabbit.  The rabbit hops into a hole and disappears.  The queen moves towards the rabbit (orients toward the hole).
> What we need:
> Once the rabbit goes into the hole, and the queen orients toward the hole/rabbit, we want the program to automatically end.
>
> Greenfoot has the Greenfoot.stop() method that stops the execution of a game when a specific action occurs, is there anything similar in Alice 3.1?
> Any assistance will be greatly appreciated!
>
> Dianne K.L. Grim, MEd
> Rockville High School
> Computer Science Dept.
> 860-870-6050  x131
> _______________________________________________
> alice-teachers mailing list
> alice-teachers at lists.andrew.cmu.edu
> https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers

_______________________________________________
alice-teachers mailing list
alice-teachers at lists.andrew.cmu.edu
https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers


More information about the alice-teachers mailing list