Ludii Forum
Pieces inserted on edges not displaying - Printable Version

+- Ludii Forum (https://ludii.games/forums)
+-- Forum: Problems (https://ludii.games/forums/forumdisplay.php?fid=5)
+--- Forum: Ludii Player Problems (https://ludii.games/forums/forumdisplay.php?fid=6)
+--- Thread: Pieces inserted on edges not displaying (/showthread.php?tid=634)



Pieces inserted on edges not displaying - dale walton - 07-06-2021

Wait on this I need to correct a script error and resend... (OK, now updated)

In the attached script and trial, a "Line" piece placed on an edge at the start shows, but those inserted to an edge during play art listed in the full moves, but don't display. - Am I missing something, or else is this a bug?  (The script is designed to add them between stones of the same color at knight's distance.)


Possible related Bug: State, as shown in the full moves tab, is not recording the level of the state.

-------------------------------------------


I also wanted to ask is there a better way to orient the lines?  I used states because I didn't know how to use the rotations feature for this.


RE: Pieces inserted on edges not displaying - Eric Piette - 07-06-2021

Hi,

1) Yes that was a bug in the code of the stacking state which was not detected when used on the edges. Now Fixed, will be in the next release.

2) For the state, I assume that's because the order of your actions in the move is not correct, just 2 examples here:
3. [(Add Ball1 to 51/0), (Remember Value 'null' 100), (State Edge 100/0=2), (Insert Line1 to Edge 100/0)]
4. [(Add Ball2 to 49/0), (Remember Value 'null' 100), (State Edge 100/1=3), (Insert Line2 to Edge 100/1)]

You are setting the state before inserting the edge. So the state becomes 0 after applying this set of actions.
I also advise you to give a name to the values you are remembering in order to have a clearer set of remembered pieces.

3) If you just want to have different rotations of any kind like you did for the svg used for "Line", yes the state is the right solution.

Regards,
Eric


RE: Pieces inserted on edges not displaying - dale walton - 07-06-2021

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.


RE: Pieces inserted on edges not displaying - dale walton - 07-08-2021

Here is my work-around game.  From your previous post it might work in your development environment. -- Ddoes it add the edges properly, and remove them if the opponent fills the gap between the pieces, or you play in the gap yourself?

If so I am looking forward to the next release.

However, with all the heavy lifting in the connection testing the AI can barely manage order 5 to depth 3 with 10 seconds of thinking.  Any chance of building in tests for knight move connection and blocking, such as might also be useful in TwixT?


RE: Pieces inserted on edges not displaying - dale walton - 07-09-2021

Apparently the bug fix only fixed the edge display for states at level 0

The attached Should display edges, but doesn't