08-10-2020, 03:04 PM
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?
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?