Awari is an ancient game originating from Africa which consists of 12 holes in the ground (called houses) split up into 2 rows of 6. Designed for two players, each player selects a row as their territory. Each house starts with 4 seeds in it.
A round in the game goes as follows:
The player picks a number of seeds from one of their houses. They sow the seeds one by one in an anti-clockwise direction around the board.
The number of seeds in the last sown house dictates what happens next:
- If there are not 2 or 3 seeds then the go finishes and its the opponents turn.
- If the last hole is one of your opponents and the number of beads is 2 or 3 you win those beads
- If you collect, then you may look at the next-to-last, and if that satisfies the same criteria, you collect those also
- If you play so many beads that they wrap around the board (more than 11) you do not ‘sow’ a bead in the house from which you picked up
If an opponent’s houses are all empty, the current player must make a move that gives the opponent seeds. If no such move is possible, the current player captures all seeds in his/her own territory, ending the game.
The game is over when:
- one player has captured 25 or more seeds
- each player has taken 24 seeds (draw).
- If both players agree that the game has been reduced to an endless cycle, each player captures the seeds on their side of the board.
Attempt to write an AI to play Awari against.