Kalah – Rules of the Game

Kalah is a two player, turn-based game. Our version is played with a board consisting of 14 small holes, two scoring wells and 98 stones. (Note: We are asking you to make an agent which plays 7,7 version of Kalah. The figures were drawn for 6,6 Kalah, which is more standard, but has now been solved.) Each player (North and South) owns the seven holes closest to them (numbered 1 – 7) and one scoring well. The figure below shows the board.


 

The game starts with seven seeds in each non-scoring hole. The game ends when one player does not have a legal move. The winner is the player with the most seeds in their scoring well.

Start of Play

The game starts with 7 seeds in each of the small holes. South goes first.

How Play Proceeds

The player whose turn it is chooses one of the 7 holes they own which is not empty. The seeds from that hole are removed and deposited one by one into the subsequent holes moving counter clockwise, skipping only the opponent’s scoring well. (Example moves are shown below).

If the last seed is deposited into the current player’s scoring well, that player must take another turn. (An exception to this is the first turn, see Pie Rule).

If the last seed is deposited into an empty hole owned by the current player and the hole opposite is not empty, the player captures all of the seeds in the opposite hole plus the capturing seed, which go into the player’s scoring well.

The player’s turn ends with a capture or when the last seed is deposited into a hole other than the player’s scoring well.

End of the Game

If it is a player’s turn and all of his holes are empty, then he has no legal move and the game ends. All seeds which are not in one of the scoring wells are deposited into the well of the opposing player. The player whose scoring well contains the most seeds is the winner.

The Pie Rule

Although this game has not been solved yet, it appears that there is a big first player advantage. The pie rule is implemented in many games for which this is the case, to make it more fair. The basic idea is that the 2nd player has at its first turn only an extra move: swap positions with the other player (e.g. turn the board around).  We implement this as follows:

1.       At the start of the game, South goes first. South has only one turn, even if it ends in the last seed deposited into South’s scoring well.

2.       At North’s first turn, it has an extra move: SWAP. If he plays swap, he becomes South,  South becomes North and it is North’s turn. At the this point, whether or not SWAP has been played, play proceeds according to the normal rules.

Example Play

The rules will be illustrated from the starting position below.  It is North’s turn.  North chooses well 6.


This moves one seed to North’s scoring well and one to Souths hole number 1. After this move, the board looks like this: (seeds are colored to make the moves more clear).  This ends North’s turn.


Now it is South’s turn. South chooses hole 5. This results a seed deposited into hole 6 and one into South’s scoring well. As that is the last seed deposited, South gets another turn. South then chooses hole 2. This results in the last seed being deposited into the empty hole 4, thereby capturing the seeds in North’s hole 3.

At the start of South’s turn, the board looks like this:

 


At the end of the turn, it looks like this: