![]() |
Moving with dice rolls, and loops. - 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 with dice rolls, and loops. (/showthread.php?tid=122) |
Moving with dice rolls, and loops. - MikeZapawa - 08-10-2020 Hi! I've started learning Ludii just yesterday. I want to implement a non-combinatorial mancala, where the movement protocol is as follows: 1. A player rolls the dice 2. A player chooses one of his nonempty pits 3. A player moves a seed from his chosen pit along a track, accordingly to the number of pips on a dice 4. If the chosen pit is empty, the turn ends. 5. If the chosen pit isn't empty, a player rerolls the dice and moves another seed from the same pit accordingly to the number of pips on a dice. 6. Come back to point 4. But I have multiple problems with implementing it -- basically 1. and 2. are the only ones I'm fairly certain about. I'd be grateful for any tips. In particular, I don't really get how to make a piece move accordingly to the number of pips. I've tried copying the code from Backgammon, but it didn't work... Also, must I treat steps 1-3 and 4-6 as separate phases (then implementing a loop with "move again") or is there some other way? RE: Moving with dice rolls, and loops. - Eric Piette - 08-11-2020 Hi, Here an example of the code to do what you describe in your 6 steps. FYI, I did not include the end rules Code: (play Regards, Eric RE: Moving with dice rolls, and loops. - MikeZapawa - 08-11-2020 Thanks a lot! I think I'll manage to define the equipment and win condition on my own. I'll post it on the forum when it's ready. With regards, Mike |