# Kalah

Kalah is a modern variation in the ancient Mancala family of games. The Kalah board was first patented and sold in the United States by William Julius Champion, Jr. in the 1950s. This game is sometimes also called "Kalahari", possibly by false etymology from the Kalahari Desert in Namibia.
For most of its variations, Kalah is a solved game with a first-player win if both players play perfect games. The pie rule can be used to balance the first-player's advantage.

## Standard gameplay

The game provides a Kalah board and a number of seeds or counters. The board has 6 small pits, called houses, on each side; and a big pit, called an end zone or store, at each end. The object of the game is to capture more seeds than one's opponent.
* At the beginning of the game, four seeds are placed in each house. This is the traditional method.
* Each player controls the six houses and the seeds on their side of the board. The player's score is the number of seeds in the store to their right.
* Players take turns sowing their seeds. On a turn, the player removes all seeds from one of the houses under their control. Moving counter-clockwise, the player drops one seed in each house in turn, including the player's own store but not their opponent's.
* If the last sown seed lands in an empty house owned by the player, and the opposite house contains seeds, both the last seed and the opposite seeds are captured and placed in the player's store.
* If the last sown seed lands in the player's store, the player gets an additional move. There is no limit on the number of moves a player can make in their turn.
* When one player no longer has any seeds in any of their houses, the game ends. The other player moves all remaining seeds to their store, and the player with the most seeds in their store wins.
It is possible for the game to end in a draw.

### Example turn

The player begins sowing from the highlighted house.
The last seed falls in the store, so the player receives an extra move.
The last seed falls in an empty house on the player's side. The player collects the highlighted seeds from both their own house and the opposite house of their opponent and will move them to the store.

## Video game implementation

Kalah was implemented on the PDP-1 in the early 1960s, and was able to out-play experienced human players. Since then, there have been myriad Kalah implementations for various operating systems and platforms, including DOS, and the Nokia 3310.

## Variations

* The game may start with a number of seeds in each house different from four. A nomenclature has been developed to describe these variations: Kalah(h,s), where h designates the number of houses on each side, and s designates the number of seeds that start out in each house. In broad terms, the more seeds, the more challenging is the game. Three-, four-, five- and six-seed Kalah have been solved, with the starting player always winning with perfect play. Thus some websites have implemented the game with the pie rule to make it fair, or the second player may be allowed to move one seed from any house to any other house before the game begins, resulting in effectively 133 different games.
* An alternative rule has players sow in a clockwise direction, requiring more stones to be sowed in a single turn to reach the store.
* The "Empty Capture" variant: If the last sown seed lands in an empty house owned by the player, even if the opposite house is empty, the last seed is captured and placed into the player's store.
* The "Seed On" variant: there are no captures when ending in an empty house. When the last seed ends in a non-empty house on either side of the board, that seed and all seeds from that house are sown. The turn only ends when the last seed falls in an empty house.
* Alternative rules either count the remaining seeds at the end of the game as part of the score of the player who has emptied their houses, or do not count them at all.

## Mathematical analysis

As mentioned above, if the last seed sown by a player lands in that player's store, the player gets an extra move. A clever player can take advantage of this rule to chain together many extra turns. Certain configurations of a row of the board can in this way be cleared in a single turn, that is, the player can capture all stones on their row, as depicted on the right. The longest possible such chain on a standard Kalah board of 6 pits lasts for 17 moves. On a general n-pit board, the patterns of seeds which can be cleared in a single turn in this way have been the object of mathematical study. One can prove that, for all n, there exists one and only one pattern clearable in exactly n moves, or equivalently, one and only one clearable pattern consisting of exactly n seeds.
These patterns require arbitrarily long rows of pits and n increases. For example, it can be seen on the right that the unique 5-seed pattern requires only 3 pits, but the 17-seed pattern requires 6 pits. The relationship between the required number of pits and the number of seeds can be described in the following way. Let s(n) denote the minimum number of seeds which requires n pits to clear. Then $s(n)\sim {\frac {n^{2}}{\pi }},$ where the symbol $\sim$ denotes asymptotic equivalence, that is, $\lim _{n\to \infty }{\frac {s(n)}{n^{2}/\pi }}=1$, or equivalently, $\lim _{n\to \infty }{\frac {n^{2}}{s(n)}}=\pi$.