Ludii Forum
Throngs (multi-step approach) - Printable Version

+- Ludii Forum (https://ludii.games/forums)
+-- Forum: Suggestions (https://ludii.games/forums/forumdisplay.php?fid=10)
+--- Forum: Submit Your Games (https://ludii.games/forums/forumdisplay.php?fid=23)
+--- Thread: Throngs (multi-step approach) (/showthread.php?tid=399)

Pages: 1 2 3


RE: Throngs (multi-step approach) - dale walton - 02-19-2021

Refering to the script https://ludii.games/forums/attachment.php?aid=364 in the post 2 up from here:

There seems to be a bug on your side in calculating moves. The last (partial) move in this trial shows a state of 2, but it should be a state of 3.  (ie 5 pieces at start of move, less 2 steps = 3: value of steps left to take.

It you back up one move, and click on the piece, the red dots show that the piece really did get an "influence" of 5 to start. and the position really is 2 steps away. and the movements for other moves in the game are calculated correctly.

Please hunt this down for me. It is important that every move in a game is calculated consistently correctly, and I can't see what is different about this particular move.

The relevant define is "MoveFriendly".

Also if you back up one move and choose a different piece using MoveFriendly  the move is correctly calculated.

I take that back. It is correctly calculated for a move of one step, but not correct for a longer move. The value becomes one less. - I will also recheck my side, but I don't see how the from - to distance for one step can be correct, but for a greater distance the count is wrong..

To clearly see this backup one step and move the piece side ways 1, 2 or 3 steps, and note that the resulting states are 4, 2, 1.


RE: Throngs (multi-step approach) - dale walton - 02-20-2021

Ok, I think I see the problem on my side:  Ineed to store these values before moving, as the influence is currently recalculated after the move, and a move step one in thus included in the calculation.  Sorry for the maybe false alarm.  I haven't been able to correct this and need advice/help.

However this doesn't allow movement at all: What is wrong with it?

(define "MoveFriendly" 
 (forEach Piece
  (do (set Var "PowerLeft" (- 7 ("InfluenceAt" (from))))
   next:(if
    (lt 0 (var "Powerleft"))
    (move
     (from (from))
     (to
      (sites Direction from:(from) Orthogonal distance:(var "Powerleft"))
      if:(is Empty (to))
     )
     (then
      (and
       (set Var "PowerLeft" (- (var "Powerleft") (count Steps (last From) (last To))))
       (set State at:(last To) (- (var "Powerleft") (count Steps (last From) (last To)))) 
  )))))
  Mover
))
-------------------------------------
buggy version that allowed movement was:

(define "MoveFriendly"
 (forEach Piece
  (if (lt 0 (- 7 ("InfluenceAt" (from))))
   (move
    (from (from))
    (to
    (sites Direction from:(from) Orthogonal distance:(- 7 ("InfluenceAt" (from))))
     if:(is Empty (to))
    )
    (then
     (and
      (set Var "PowerLeft" (- (- 7 ("InfluenceAt" (last From))) (count Steps (last From) (last To))))
      (set State at:(last To) (- (- 7 ("InfluenceAt" (last From))) (count Steps (last From) (last To)))) 
  ))))
  Mover
))
-----------------------------
And this version does not allow continuation: (Powerleft/State end up at 0)- it also complains because the (set Var) is a non-decision move.
(define "MoveFriendly"
 (forEach Piece
  (if
   (lt 0 (- 7 ("InfluenceAt" (from))))
   (and
    (set Var "PowerLeft" (- 7 ("InfluenceAt" (from))))
    (move
     (from (from))
     (to
      (sites Direction from:(from) Orthogonal distance:(- 7 ("InfluenceAt" (from))))
      if:(is Empty (to))
    ))
    (then
     (and
      (set Var "PowerLeft" (- (var "Powerleft") (count Steps (last From) (last To))))
      (set State at:(last To) (- (var "Powerleft") (count Steps (last From) (last To)))) 
  ))))
  Mover
))


RE: Throngs (multi-step approach) - dale walton - 02-20-2021

OK, rather than try to solve this directly, I went back and was able to get a simple Select move to function properly for the "MoveFriendly" case. eliminating the complications.  I also took the opportunity to clean up the code and add in state-based piece styling to show selection of the moving piece, so it is now working quite reasonably. It would be nice if the Selects could be characterized as "from" for the MoveFriendly select, and "to" for the continuation Select. but it is not important and not going to happen...

So that all fine except the AI is consistantly hanging now:
I am attaching the new script, and a sample of a trial that hung.

Here is the terminal output, and I am attaching the trial using A/B vs A/B at one second.

Compiled Throngs successfully.
Exception in thread "Thread-61" java.lang.ArrayIndexOutOfBoundsException: Index 6 out of bounds for length 6
at util.zhash.HashedChunkSet.setChunk(HashedChunkSet.java:168)
at util.state.containerState.ContainerGraphState.setSite(ContainerGraphState.java:1268)
at util.action.state.ActionSetState.apply(ActionSetState.java:78)
at util.Move.apply(Move.java:469)
at util.Move.apply(Move.java:489)
at game.Game.applyInternal(Game.java:2707)
at game.Game.apply(Game.java:2661)
at search.minimax.AlphaBetaSearch.alphaBeta(AlphaBetaSearch.java:541)
at search.minimax.AlphaBetaSearch.alphaBeta(AlphaBetaSearch.java:584)
at search.minimax.AlphaBetaSearch.alphaBeta(AlphaBetaSearch.java:584)
at search.minimax.AlphaBetaSearch.alphaBeta(AlphaBetaSearch.java:542)
at search.minimax.AlphaBetaSearch.iterativeDeepening(AlphaBetaSearch.java:306)
at search.minimax.AlphaBetaSearch.selectAction(AlphaBetaSearch.java:182)
at util.ThinkingThread$ThinkingThreadRunnable.run(ThinkingThread.java:186)
at java.base/java.lang.Thread.run(Thread.java:834)
File encoding: UTF-8


RE: Throngs (multi-step approach) - dale walton - 02-20-2021

Is this AI hanging bug one you already fixed, but not yet released?

Actually the error appears in the terminal when I click on a piece that will be assigned a state of 6 or 7 which matches the Java error of index 6 out of bounds for length 6.  Can this limit be increased to allow up to 7 or more?

So it is not just an AI error, such pieces are unplayable.

There seem to be, as well, additional AI halting java.lang.ArrayIndexOutOfBoundsExceptions that I cannot duplicate by manually selecting pieces.

I have also updated the visuals to hide the 0 state now, which is looking very good - see attached. Hash 1212610307.

And I did a temporary correction on the file that works with the AI, but is not so pretty and consistent as a stop-gap, until the state bug is fixed. Hash -1903686766
I also include a sample trial using the tempfix version - Showing that version is working


RE: Throngs (multi-step approach) - Eric Piette - 02-22-2021

Hi,

I am not sure what you ask for here?
I tried your .lud without the fix and run the trial and I do not get any exception.

Regards,
Eric


RE: Throngs (multi-step approach) - dale walton - 02-23-2021

Please try the following using the file:  Throngs - working.lud

Add 7 pieces of one player to make a solid hexagon, then click the central piece of the group. On my system you can see the result in the screenshot.

P.S. I just downloaded 1.1.15 and this is what I got. --It means, what happened to the graphics???


RE: Throngs (multi-step approach) - Eric Piette - 02-24-2021

Hi,

This game is using the local state, right?
If this is the case the maximum value of the local state is determined in the initial state in looking the piece with the maximum local state, if no piece has initially a local state but the game is going to use the local state, the maximum local state is the number of players. Some different more specific cases exits in term of dice or large pieces using both local state.
So the problem you encounter here comes from that.

I will check with the team if it would be good to allow the designers to modify that maximum value in the meta rule. I come back to you after that discussion.


RE: Throngs (multi-step approach) - dale walton - 02-24-2021

Thanks,

I hope there is some kind of work around. Here the maximum needed is the neighborhood of 7, but other games could be different, and many games start with empty boards.

Oh. - And what happened to the line widths, land lines getting drop shadow and strange angle defects, that happened after downloading 1.1.15? Please compare the appearance of the game in the two pictures above...


RE: Throngs (multi-step approach) - Eric Piette - 02-24-2021

Hi,

We are going to add the possible to specify the maxState (and the other data) related to the pieces in the (piece ...) definition.
Then the maximum will be the maximum specified in them.

I will ask Matthew to answer to you about the GUI

Eric


RE: Throngs (multi-step approach) - MatthewStephenson - 02-24-2021

Hi,

Our default graph style colours/sizes have changed in the latest release, so you'll need to update the metadata for this game.

I was able to closely replicate the original style by using this graphics metadata

(graphics
{
(player Colour P1 (colour DarkGrey))
(player Colour P2 (colour White))
(board Background image:"Disc.svg" fillColour:(colour 230 230 230) edgeColour:(colour 230 230 230) scale:1.2 rotation:150 offsetX:-.01 offsetY:<Board:centering>)
(board StyleThickness InnerEdges 2.0)
(board StyleThickness OuterEdges 8.0)
(board Colour InnerVertices (colour Black))
(board Colour OuterVertices (colour Black))
(board Colour InnerEdges (colour 200 200 200 255))
(board Colour OuterEdges (colour Grey))
(no Sunken)
}
)

You might need to tweak some of the colours and sizes but you should be able to replicate the original design.

Cheers,
Matthew