11-26-2020, 01:43 PM
Hi,
(swap Pieces ...) can be used only to swap two pieces. So between 2 IntFunctions and not with a RegionFunction (cf the Ludii Language Reference or the grammar).
However in the next release (because I just fixed/improved something in (forEach Site ...)) for swapping one of your piece with each possible adjacent enemy pieces, you can do it; Here a full example (for the next release):
Regards,
Eric
(swap Pieces ...) can be used only to swap two pieces. So between 2 IntFunctions and not with a RegionFunction (cf the Ludii Language Reference or the grammar).
However in the next release (because I just fixed/improved something in (forEach Site ...)) for swapping one of your piece with each possible adjacent enemy pieces, you can do it; Here a full example (for the next release):
Code:
(game "Test"
(players 2)
(equipment {
(board (square 8))
(piece "Ball" Each
(forEach
Site
(sites Around (from) if:(is Enemy (who at:(to))))
(move Swap Pieces (from) (site))
)
)
})
(rules
(start {
(place "Ball1" 36)
(place "Ball2" (sites {35 37}))
})
(play (forEach Piece))
(end (if (no Moves Next) (result Mover Win)))
)
)
Regards,
Eric