Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Thread Tools Display Modes
Prev Previous Post   Next Post Next
Posts: n/a
Default 04-18-2007, 08:29 PM

Originally Posted by DrJim View Post
Thanks for the nice example. Demonstrating my basic ability to make good code inoperable - see the attached, which, when "D" is pressed and released, stops and gives an error message much the same as for as the walk and bumper car examples.

All I did was add an indexed loop to the dance method. Hence, when the "D" key is released, the method stops in mid-loop. Apparently this isn't a good idea as far as Alice is concerned (and I tend to agree - just wish the error message was clearer ).
This reminds me of when I used to go on business trips and land in a strange city late at night and be faced with driving and trying to read the street signs and read a map all at the same time. At least then I was able to get a map from the car rental agency. When something strange like this happens with Alice, there is no map to refer to, so it is guesswork all the way.

I have never been involved with a programming environment that had anything like a doTogether block so I don't have any historical knowledge to fall back on in this area. I wonder what the Alice dev team intended for the behavior to be when a loop is included inside a doTogether block. Then I wonder if the behavior that you get is what they intended for it to be. Probably not.

The attached file seems to confirm your belief that the problem arises when the while event terminates before the loop terminates. If you run this example and release the D-key during the wait period after the loop terminates and before the next execution of the method, no runtime error is generated.

Have you done enough testing to confirm that the use of a loop inside a doTogether block always, or almost always results in an error. I tried to think of an easy way to write a test case that would eliminate the while event from the picture but so far haven't figured out how to do that. Everything I have come up with would cause the loop inside the doTogether block to terminate in an orderly fashion.

Dick Baldwin
Attached Files
File Type: a2w Problem0190a.a2w (2.17 MB, 284 views)
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Copyright ©2019, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.