Kalah - Rules of the Game

Kalah is a two player, turn-based game. In the standard version of the game, it is played with a board consisting of 12 small pits, two scoring wells and 72 stones. Each player (North and South) owns the six holes closest to them (numbered 1 - 6) and one scoring well. The game starts with 6 stones in each pit. The figure below shows the board.

However, that version of the game is solved, so in this project, you will be playing an expanded version of the game. There are 7 pits per side, and each pit starts with 7 stones.

A standard nomenclature for versions of the game is (p,s), where p is the number of pits per side, and s is the number of stones in each pit at the start. The standard game is (6,6) although (6,3) is often used for beginners. Your bot will be playing the (7,7) version of the game.


 

The game starts with six 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.

Here is an example of the Pie Rule. Before the game starts, Sally is South, Noddy is North. Sally opens with a brilliant move, almost ensuring that she will win. Noddy swaps. Now Sally is North and must immediately respond with a move against her own brilliant opening move. Noddy is now South, and plays with the benefit of Sally's opening move.

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: