![]() |
Mirroring/Rotating Moves - 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: Mirroring/Rotating Moves (/showthread.php?tid=1041) |
Mirroring/Rotating Moves - pbcarrara - 06-29-2022 I'm trying to implement Onitama, a game where cards dictate piece moves. When you use a card, you then give it to your opponent, but flipped! For example: Player 1 (red) has the cobra card, so they have the following available moves: ![]() ![]() Now, when Player 2 receives the cobra card, they should have the following options (notice how things have flipped): ![]() ![]() I'll implement the cards later on; for now, I'm just trying to have two pawns move in the “Cobra” pattern. But I wouldn't like to define two separate pieces with different walk patters, since I think this will generate verbose and repetitive code. Is there a way I can “horizontally flip” a walk pattern? This being replacing every L with an R and vice-versa. Code: // How do I make this more generic? RE: Mirroring/Rotating Moves - dale walton - 06-30-2022 Related question: is (if <boolean> <walk> <walk>) allowed? RE: Mirroring/Rotating Moves - Michael - 06-30-2022 You can make the define more generic by replacing the Ls and Rs with #1 and #2. Those stand for the first and second arguments passed. |