(move <from> <to>) - 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: (move <from> <to>) (/showthread.php?tid=184) |
(move <from> <to>) - Michael - 09-18-2020 I can't get the following to work: Code: (move The intended effect is that one chooses a piece that is not already the westmost piece in its row, and then move it to the playable site just west of the westmost piece in that row. What am I misunderstanding? RE: (move <from> <to>) - Eric Piette - 09-18-2020 Hi Michael, Yes that's because you use a boarderless game. The problem comes from your use of (sites Left) here. That will return the leftmost sites of the "fake" board we have currently for each boardless game (we plan to improve that in the future, but for the moment that works like that). To get the leftmost pieces currently in the board, I guess you will have to get the pieces currently on the board with the lowest row index. Regards, Eric RE: (move <from> <to>) - Michael - 09-18-2020 Thanks! That's good to know. I can't quite figure out how to return the site with the lowest index in a given row. (min …) is binary, so it seems I have to iterate using (set Var …), like this maybe: Code: (set Var (from) Edit: I think I'm even more confused than I thought, because I (think I) have to get at the lowest index of the row inside the context of (move <from> <to>), since the relevant row is the row of (from). Then (moveAgain) won't help me, and I'm back at having no idea. Is there a way of wrapping something like this code up in a function that simply returns (var) so I can treat it like a value? RE: (move <from> <to>) - Michael - 10-04-2020 I still can’t figure out how to return the lowest index of a given row. And I find the behavior of (forEach Site) to be very counter-intuitive, so I’m pretty sure nothing like what I was thinking above works. |