PDA

View Full Version : Strangest thing happening to Alice


roofy
10-29-2006, 08:48 AM
I cannot do a do together. When I try and then press play, I get this error....

Error during simulation.




Alice version: 2.0 04/05/2005

os.name: Windows XP

os.version: 5.1

os.arch: x86

java.vm.name: Java HotSpot(TM) Client VM

java.vm.version: 1.3.1_10-b03

user.dir: C:\Program Files\Alice\Required



Throwable that caused the error:

java.lang.ArrayIndexOutOfBoundsException: -1 not in range [0,2)

at edu.cmu.cs.stage3.alice.core.Behavior$Fork.getNext (Behavior.java:113)

at edu.cmu.cs.stage3.alice.core.Behavior$RuntimeStack .top(Behavior.java:55)

at edu.cmu.cs.stage3.alice.core.Behavior.stackLookup( Behavior.java:269)

at edu.cmu.cs.stage3.alice.core.Property.evaluateIfNe cessary(Property.java:367)

at edu.cmu.cs.stage3.alice.core.Property.getValue(Pro perty.java:407)

at edu.cmu.cs.stage3.alice.core.question.BinaryObject ResultingInBooleanQuestion.getValue(BinaryObjectRe sultingInBooleanQuestion.java:44)

at edu.cmu.cs.stage3.alice.core.Property.evaluateIfNe cessary(Property.java:380)

at edu.cmu.cs.stage3.alice.core.Property.getValue(Pro perty.java:407)

at edu.cmu.cs.stage3.alice.core.property.BooleanPrope rty.getValue(BooleanProperty.java:33)

at edu.cmu.cs.stage3.alice.core.property.BooleanPrope rty.getBooleanValue(BooleanProperty.java:45)

at edu.cmu.cs.stage3.alice.core.property.BooleanPrope rty.booleanValue(BooleanProperty.java:48)

at edu.cmu.cs.stage3.alice.core.behavior.ConditionalB ehavior.preSchedule(ConditionalBehavior.java:36)

at edu.cmu.cs.stage3.alice.core.Sandbox.scheduleBehav iors(Sandbox.java:69)

at edu.cmu.cs.stage3.alice.core.World.scheduleBehavio rs(World.java:444)

at edu.cmu.cs.stage3.alice.core.World.schedule(World. java:486)

at edu.cmu.cs.stage3.alice.core.clock.DefaultClock.sc hedule(DefaultClock.java:94)

at edu.cmu.cs.stage3.alice.authoringtool.AuthoringToo l$11.run(AuthoringTool.java:681)

at edu.cmu.cs.stage3.alice.authoringtool.util.Default Scheduler.simulateOnce(DefaultScheduler.java:115)

at edu.cmu.cs.stage3.alice.authoringtool.util.Default Scheduler.run(DefaultScheduler.java:76)

at edu.cmu.cs.stage3.scheduler.AbstractScheduler.run( AbstractScheduler.java:45)

at java.awt.event.InvocationEvent.dispatch(Unknown Source)

at java.awt.EventQueue.dispatchEvent(Unknown Source)

at java.awt.EventDispatchThread.pumpOneEventForHierar chy(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForHierarch y(Unknown Source)

at java.awt.Dialog.show(Unknown Source)

at edu.cmu.cs.stage3.swing.DialogManager.showModalDia log(DialogManager.java:58)

at edu.cmu.cs.stage3.swing.DialogManager.showDialog(D ialogManager.java:123)

at edu.cmu.cs.stage3.alice.authoringtool.AuthoringToo l.play(AuthoringTool.java:5073)

at edu.cmu.cs.stage3.alice.authoringtool.Actions$15.a ctionPerformed(Actions.java:167)

at javax.swing.AbstractButton.fireActionPerformed(Unk nown Source)

at javax.swing.AbstractButton$ForwardActionEvents.act ionPerformed(Unknown Source)

at javax.swing.DefaultButtonModel.fireActionPerformed (Unknown Source)

at javax.swing.DefaultButtonModel.setPressed(Unknown Source)

at javax.swing.plaf.basic.BasicButtonListener.mouseRe leased(Unknown Source)

at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)

at java.awt.Component.processMouseEvent(Unknown Source)

at java.awt.Component.processEvent(Unknown Source)

at java.awt.Container.processEvent(Unknown Source)

at java.awt.Component.dispatchEventImpl(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.LightweightDispatcher.retargetMouseEvent( Unknown Source)

at java.awt.LightweightDispatcher.processMouseEvent(U nknown Source)

at java.awt.LightweightDispatcher.dispatchEvent(Unkno wn Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Window.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.EventQueue.dispatchEvent(Unknown Source)

at java.awt.EventDispatchThread.pumpOneEventForHierar chy(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForHierarch y(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.run(Unknown Source)



has any encounter this problem?

and BTW, I even tried restarting Alice.

gabe
10-29-2006, 09:24 AM
roofy,

Can you attach a sample world that exhibits this problem? I'd like to see if I can reproduce it.

roofy
10-29-2006, 09:54 AM
sure no problem.

here is the file
the problem happens when I call world.activateToss

roofy
10-29-2006, 10:12 AM
I also forgot to mention when the bug happens

1st press play
2nd wait for the ready text to appear. Once it does, click on it, and it will move back down underneath the ground,
3rd Once the text is underneath the ground, press the spacebar. This will activate the slider timer.
4th Hit the spacebar again and this will stop the slderbar from moving and what should happen next is the world.activateToss method, but instead I get the error.

also, this only happens to this file, meaning any other new scenery, the do together works again.

DrJim
10-29-2006, 08:47 PM
Gabe (or whoever),

When you're looking at roofy's problem, also consider the attached example of a problem I've had. In the two or three times I've tried to have something happen at the "End" part of an Event call, I've always gotten an error message when I stopped the world - and the event I wanted at the end didn't happen. :confused:

Since it wasn't something I really needed, I never tracked down the problem - but what brought this to mind was that it's at the same place where roofy's problem occurs. :o

llnnin
10-29-2006, 10:40 PM
i kinda have the same problem, i have a keyboard event that's suppose to do this do together while a key is pressed, it works when i press the key but when i release the key i get an error message, so i have to disable part of it in order to make it work, the only way i found around it is to change the event to when a key is typed instead of pressed, but that's not really wat i needed

roofy
10-30-2006, 03:30 PM
I have to agree with DrJim. I have did some tweeking, to go arround the event handler problem but now I got I long nested if statment. Therefore could someone help me in cleaning this up? Also before I post my code, let me explain what my concept is. The problem I am trying to solve is as follows...

1. check to make sure that the introduction is over and the user can start playing
2. check to make sure if it is the user's turn to play as oppose to the computer's turn.
3. has the user set the strength bar to the prefrence of how far the horseshoe should be thrown
4. has the user toss both horseshoes.


with these questions I have came up with this so far...


practice horseshoe's Code
Created by: Robert Neilen
world
Methods
world.horseshoeJump ( )
No variables
Do in order
// make sure that the game is finished the introduction
If ( ( Rules of the game . opacity ) == 0 )
// make sure that it is player1 turn to toss the horseshoses
If ( world.currentPlayer == player1 )
// check to see if the user has toss the first horseshoe
If ( magnet is at least 1 meter away from RightArm.palm )
// if the first horseshoe was thrown, then check to see if the user has
thrown the second horseshoe yet?
If ( Magnet2 is at least 1 meter away from RightArm.palm )
// if all statements are true then switch to computer's turn
Else
// throw the second horseshoe
Else
// throw the first horseshoe
Else
Do Nothing
Else
Do Nothing


I hope you guys can understand this. If not then I guess the next solution is giving you the example file.

DrJim
10-30-2006, 09:18 PM
roofy - saw you were logged in as I was logging out and decided to add an update. Think I may be on the way to figuring out the event thing but its going to take a couple more days. :o

Re the nested "if's" - don't really see a more compact way unless Alice supports "case" statements, which I don't think it does. (Not even sure if they exist in Jave - never worked with it before now.)