Amy
03-21-2007, 02:11 PM
Right now, I am working on a project for my programming class. We have to use events with functions to make somehting happen, if something else is true. Everything was going fine, but then when my dog gets near the bird, the error comes up. Here is the error:
Error during simulation.
Alice version: 2.0 04/05/2005
os.name: Windows XP
os.version: 5.2
os.arch: x86
java.vm.name: Java HotSpot(TM) Client VM
java.vm.version: 1.3.1_10-b03
user.dir: D:\Program Files\Alice\Required
Throwable that caused the error:
java.lang.ArrayIndexOutOfBoundsException: -1 not in range [0,3)
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$RuntimeStack .push(Behavior.java:43)
at edu.cmu.cs.stage3.alice.core.Behavior.pushStack(Be havior.java:352)
at edu.cmu.cs.stage3.alice.core.question.userdefined. CallToUserDefinedQuestion.getValue(CallToUserDefin edQuestion.java:53)
at edu.cmu.cs.stage3.alice.core.behavior.ConditionalT riggerBehavior.internalSchedule(ConditionalTrigger Behavior.java:38)
at edu.cmu.cs.stage3.alice.core.Behavior.schedule(Beh avior.java:225)
at edu.cmu.cs.stage3.alice.core.Sandbox.scheduleBehav iors(Sandbox.java:70)
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)
right now, it is programmed to do this:
If the dog gets within 1 meter of the bird, the dog will jump up and the bird will move upward, then they each return to their original positions. If I take everythign out of the method that is called, and just leave in "dog say hi," then it works.
Hope you understand what I mean. if you need me to post my code or something, I can, just let me know.
Thanks!
Error during simulation.
Alice version: 2.0 04/05/2005
os.name: Windows XP
os.version: 5.2
os.arch: x86
java.vm.name: Java HotSpot(TM) Client VM
java.vm.version: 1.3.1_10-b03
user.dir: D:\Program Files\Alice\Required
Throwable that caused the error:
java.lang.ArrayIndexOutOfBoundsException: -1 not in range [0,3)
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$RuntimeStack .push(Behavior.java:43)
at edu.cmu.cs.stage3.alice.core.Behavior.pushStack(Be havior.java:352)
at edu.cmu.cs.stage3.alice.core.question.userdefined. CallToUserDefinedQuestion.getValue(CallToUserDefin edQuestion.java:53)
at edu.cmu.cs.stage3.alice.core.behavior.ConditionalT riggerBehavior.internalSchedule(ConditionalTrigger Behavior.java:38)
at edu.cmu.cs.stage3.alice.core.Behavior.schedule(Beh avior.java:225)
at edu.cmu.cs.stage3.alice.core.Sandbox.scheduleBehav iors(Sandbox.java:70)
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)
right now, it is programmed to do this:
If the dog gets within 1 meter of the bird, the dog will jump up and the bird will move upward, then they each return to their original positions. If I take everythign out of the method that is called, and just leave in "dog say hi," then it works.
Hope you understand what I mean. if you need me to post my code or something, I can, just let me know.
Thanks!