Ludii Forum
Moving Player Pieces and Shared Pieces - Printable Version

+- Ludii Forum (https://ludii.games/forums)
+-- Forum: Questions (https://ludii.games/forums/forumdisplay.php?fid=13)
+--- Forum: About the Ludii Grammar (https://ludii.games/forums/forumdisplay.php?fid=15)
+--- Thread: Moving Player Pieces and Shared Pieces (/showthread.php?tid=535)



Moving Player Pieces and Shared Pieces - Enrique - 04-07-2021

I'm trying to implement a game with pieces for each player and a third neutral piece that can be moved by any player.

I can define

Code:
(play (forEach Piece))

And both players can move their own pieces only. Thats ok.

If I write

Code:
(play (forEach Piece Shared))

Both players can move the shared pieces. Ok too.

But I don't know how to allow them to have both options together.

I figured that

Code:
(play
  {
    (forEach Piece)
    (forEach Piece Shared)
  }
)

will work but I get an error.

Any ideas?


RE: Moving Player Pieces and Shared Pieces - Enrique - 04-07-2021

I've found it!

The correct code is:

Code:
(play
  (and
    (forEach Piece)
    (forEach Piece Shared)
  )
)

EDIT: also works with OR


RE: Moving Player Pieces and Shared Pieces - cambolbro - 04-08-2021

Hi,

Great!

Regards,
Cameron