alice-teacher Program problem

Don Slater dslater at andrew.cmu.edu
Wed Nov 2 16:37:59 EDT 2011


As I looked at the screen shot the event "When W is typed do shark move forward" was responsible for moving the shark… It is true that the infinite loop keeps the if statement active, but the condition is continually checked whether the w is typed or not, therefore one set of actions or the other will execute over and over…

The if-else statement needs to be closely linked to the action that is being checked… In other words, every time the shark moves, check to see the result of the move.

This if-else could be placed in a world level method "check result" and then the event might look like

	"When W is typed do 
		shark move forward
		check result"

This method would be called with other events that generate a shark move…

It is often tricky to combine events with executable code in "my first method"

The "When something becomes true" event, described in another post may be a better implementation…

Later,
Don Slater

On Nov 2, 2011, at 11:57 AM, A. Jeff Goldstein wrote:

> If the shark is moving, this must be looped, otherwise, it’s only good for one instant where ever the shark is located at that time.
>  
> Jeff
>  
>  
> From: alice-teachers-bounces+ajeff.goldstein=vbschools.com at lists.andrew.cmu.edu [mailto:alice-teachers-bounces+ajeff.goldstein=vbschools.com at lists.andrew.cmu.edu] On Behalf Of Emily Higgins
> Sent: Wednesday, November 02, 2011 8:12 AM
> To: Alice educators
> Subject: alice-teacher Program problem
>  
> Hi All -
> One of my students is having a problem with an if...else statement.  I have used the same setup myself, coupled with a loop, and had it work fine.  As is, the lifeboat does not ever recognize the shark, even if the shark is literally in the boat.  If you have a moment to look and get back to me, I would really appreciate it.  I have put in a screenshot of the bulk of the program.  My hunch is that one of his events is causing the problem, but still just can't figure it out.  
> Thanks to all,
> Emily Higgins
> BRHS
> Boothbay Harbor, Maine<image001.png>
> _______________________________________________
> 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