Ludii Forum
How can I move a piece which is not at the top of a stack? - Printable Version

+- Ludii Forum (https://ludii.games/forums)
+-- Forum: Questions (https://ludii.games/forums/forumdisplay.php?fid=13)
+--- Forum: About Ludii (https://ludii.games/forums/forumdisplay.php?fid=14)
+--- Thread: How can I move a piece which is not at the top of a stack? (/showthread.php?tid=1640)



How can I move a piece which is not at the top of a stack? - Alain Busser - 08-12-2023

Hi,

I invented a game while reading the language reference:
  • The pieces are like those of Othello's (I choose red and blue discs).
  • The game is played on a graph. The vertices are used (so the pieces are stacked on the vertices during play).
  • P1 can only move a disc which is red side up, P2 can only move a disc which is blue side up.
  • Before moving a disc to an adjacent vertex, one flips all the pieces which are already on this destination vertex.
  • Actually it is an n players game. Each piece from the new stack changes its color from P1 to P2 to P3 etc.

I call this game weathercock because in France this is how we call someone who changes from political team too easily. Here is included what I could get at. There are several problems:
  • Only the piece which is on top of a stack can be moved, so that the game is ended while there are still playable discs, which are not on top of the stack. I guess I could use forEach Level but I don't find out how.
  • The stack should be flipped before the move and not after (the moving disc should not be flipped).
  • With stack:True all the discs present at the (from) location are moved (piled upon the flipped stack) but with stack:False the stack at the destination are removed. What I want is that the disc which moves be the only one from its stack to move, and that its new comrades just change their color, without disapearing.

To sum up, how can I move a piece which is not at the top of a stack? And how can I flip the stack before the move?