04-04-2021, 10:08 AM
I just started with ludii and I'm learning how the language works. Now I'm struggling with a conditional clause for movement.
The setup is a square board with checkers pieces on it. I want to move the pieces in any direction through empty spaces until they reach the farthest location.
I've managed to accomplish this with:
But I want to allow this movement only if the piece ends it next to an Enemy piece in the same direction. I've tried to add somewhere an if clause similar to the following one
but I don't know how to make it work. Do you know any examples I can look at?
The setup is a square board with checkers pieces on it. I want to move the pieces in any direction through empty spaces until they reach the farthest location.
I've managed to accomplish this with:
Code:
(piece "Disc" Each
(move
(from)
(to (sites LineOfSight Farthest at:(from)))
)
)
But I want to allow this movement only if the piece ends it next to an Enemy piece in the same direction. I've tried to add somewhere an if clause similar to the following one
Code:
if:(not (is Friend (who at:(sites LineOfSight Piece at:(from)))))
but I don't know how to make it work. Do you know any examples I can look at?