07-06-2021, 01:42 PM
(This post was last modified: 07-07-2021, 07:03 AM by dale walton.)
Taking the program further and using the edges to check for enclosure, I am getting strange result and an index error.
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: Index 91 out of bounds for length 81
at other.state.stacking.ContainerStateStacks.verifyPresent(ContainerStateStacks.java:261)
at other.state.stacking.ContainerStateStacks.addItem(ContainerStateStacks.java:280)
at other.action.move.ActionInsert.apply(ActionInsert.java:113)
at other.move.Move.apply(Move.java:485)
at other.move.Move.apply(Move.java:485)
at other.move.Move.apply(Move.java:505)
at game.Game.applyInternal(Game.java:2757)
at game.Game.apply(Game.java:2724)
at other.move.Move.getActionsWithConsequences(Move.java:453)
at other.model.AlternatingMove.verifyMoveLegal(AlternatingMove.java:543)
at app.move.MoveHandler.moveChecks(MoveHandler.java:770)
at app.move.MoveHandler.tryGameMove(MoveHandler.java:93)
at app.move.MouseHandler.mouseReleasedCode(MouseHandler.java:92)
at app.display.MainWindowDesktop.lambda$mouseReleased$1(MainWindowDesktop.java:300)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
In addition to the error, and possibly unrelated, the added functionality seems to be working for surrounding things orthogonally, but is not detecting the "NotCrossingKnightBoundary" conditions. The pieces in the knights' square in the upper left should have been captured to end the game already.
-----------------------------------------------------------------------------
As an update about this, the index error does not seem to occur if I place the "Line" pieces in levels 1 & 2 with states 1,2,3,4; instead of in level 0 & 1, with states 0,1,2,3. That does not solve the capture problem though, and I am reporting it incase it helps you to isolate the index problem.
-----------------------------------------------------------------------------
Update: I have found a workaround to testing the edges for a "Line" piece for the win condition. I may still need to test them to be able to remove the "Line" piece when the connection is broken.
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: Index 91 out of bounds for length 81
at other.state.stacking.ContainerStateStacks.verifyPresent(ContainerStateStacks.java:261)
at other.state.stacking.ContainerStateStacks.addItem(ContainerStateStacks.java:280)
at other.action.move.ActionInsert.apply(ActionInsert.java:113)
at other.move.Move.apply(Move.java:485)
at other.move.Move.apply(Move.java:485)
at other.move.Move.apply(Move.java:505)
at game.Game.applyInternal(Game.java:2757)
at game.Game.apply(Game.java:2724)
at other.move.Move.getActionsWithConsequences(Move.java:453)
at other.model.AlternatingMove.verifyMoveLegal(AlternatingMove.java:543)
at app.move.MoveHandler.moveChecks(MoveHandler.java:770)
at app.move.MoveHandler.tryGameMove(MoveHandler.java:93)
at app.move.MouseHandler.mouseReleasedCode(MouseHandler.java:92)
at app.display.MainWindowDesktop.lambda$mouseReleased$1(MainWindowDesktop.java:300)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
In addition to the error, and possibly unrelated, the added functionality seems to be working for surrounding things orthogonally, but is not detecting the "NotCrossingKnightBoundary" conditions. The pieces in the knights' square in the upper left should have been captured to end the game already.
-----------------------------------------------------------------------------
As an update about this, the index error does not seem to occur if I place the "Line" pieces in levels 1 & 2 with states 1,2,3,4; instead of in level 0 & 1, with states 0,1,2,3. That does not solve the capture problem though, and I am reporting it incase it helps you to isolate the index problem.
-----------------------------------------------------------------------------
Update: I have found a workaround to testing the edges for a "Line" piece for the win condition. I may still need to test them to be able to remove the "Line" piece when the connection is broken.