08-11-2020, 08:57 AM
(This post was last modified: 08-11-2020, 08:57 AM by Eric Piette.)
Hi Alek,
The reason is because you compute the line of sight from the last 'to' position but when a player swaps, that position does not exist (equal to -1), consequently, the set of legal moves is empty and the game ends.
To solve that, you have to store the (last To) position in a variable and then using that to compute the legal moves.
I did it for you, see attachment.
Moreover, I also used some phases in order to avoid the test you have for the first move. That's more efficient and avoid to do that test at each new state.
Tell me if you are ok with all of that, but if you are and are also agree to add your game to our ludii repository we can do it for the next release (with you in credits of course) :)
Regards,
Eric
The reason is because you compute the line of sight from the last 'to' position but when a player swaps, that position does not exist (equal to -1), consequently, the set of legal moves is empty and the game ends.
To solve that, you have to store the (last To) position in a variable and then using that to compute the legal moves.
I did it for you, see attachment.
Moreover, I also used some phases in order to avoid the test you have for the first move. That's more efficient and avoid to do that test at each new state.
Tell me if you are ok with all of that, but if you are and are also agree to add your game to our ludii repository we can do it for the next release (with you in credits of course) :)
Regards,
Eric