I'm writing a Nine Men's Morris game in Java and have already the implemented the game rules and an AI using negamax. However, the game is based on arrays and move generation takes quite some time when the AI is thinking (starting from a ply of 6).
My positions array is based on the following diagram:
// 0 1 2
// 3 4 5
// 6 7 8
// 9 10 11 12 13 14
// 15 16 17
// 18 19 20
// 21 22 23
I've got further arrays filled with possible mills and adjacent positions.
I decided to change the game from arrays to using bitboards so that move generation and other areas that currently use arrays will be much more faster.
My first step would be to have a bitboard for each player which will keep track of the player's pieces on the board.
The second steps would be to determine where the free positions are. I know I can do this by doing:
freepositions = ~(player1bb | player2bb);
So my question is, how can I setup/update the player's bitboards to keep track of their pieces?
Taking into consideration that a player's bitboard is 24bits long with position 0 of the board being the first bit, setting the bitboard when a player makes a move turns out to be quite simple by doing the following:
player1bb |= (1 << pos);