Kalaha is one of a thousand different variations of "the bean game". I understand the genre is called Mancala,
and it seems every African region had its own version. Our version
uses 4 rows of holes, instead of 2, like many others, and you use 24 stones.
The Goal
The game ends when one player cannot make any more moves. The player who can still move is the
winner!
The Board
The board has two rows of holes for each player:
Home Row: The row closest to you (Holes 1-8).
Fighting Row: The row further away from you (Holes 9-16).
The opponent's rows are opposite yours. Your Hole 9 is opposite their Hole 16, your Hole 10 opposite their 15,
and so on.
Each player starts with 24 stones. Two stones are placed in each of your first 12 holes (Holes 1 through 12).
Your Holes 13, 14, 15, and 16 start empty (and the same applies to the opponent).
Your Turn: Making a Move
On your turn, follow these steps:
Pick a Hole: Choose one of your 16 holes that contains more than one
stone. You cannot start a move from a hole with only one or zero stones.
Pick Up Stones: Pick up all the stones from the hole you chose.
Sow the Stones: Moving counter-clockwise around your 16 holes (from 1 ->
8, then 9 -> 16, then back to 1), drop one stone into each hole until your hand is empty.
After Sowing: What Happens Next?
Look where you dropped your very last stone:
Last Stone in an EMPTY Hole: If the last stone lands in a hole that was empty before you
dropped it in, your turn is over. It's now the opponent's turn.
Last Stone in an OCCUPIED Hole: If the last stone lands in a hole that already contained
stones (it now has 2 or more):
Pick up all the stones now in that landing hole (including the one you just
dropped).
Capture Check: If that landing hole was in your Fighting Row
(Holes 9-16), you also capture! Pick up all the stones from the opponent's hole directly opposite
your landing hole and add them to the stones in your hand.
Continue Sowing: You must continue your turn by sowing the stones you just picked
up (starting from the next hole after the one you just landed in). Repeat the "After
Sowing" steps based on where the *new* last stone lands.
App special: the 100 sowing steps rule
If you have made 100 sowing steps, your turn is over, even if you have not landed in an empty hole. A sowin step starts with picking up stones from a hole, and ends after you have dropped the last stone in your hand into another hole.
Reason: in this variant of Kalaha, there are positions that lead to an infinite sowing loop, ie. your move
can never finish. In my testing, I came across a position that would repeat after 343 consecutive sowing steps.
Not fun. Therefore: you can sow a hand of beans for 100 times, andthen, even if you haven't landed in an empty hole, your turn is over.
Game End and Winning
The game ends immediately when a player, at the start of their turn, finds they have no legal
moves (meaning all their holes have only 0 or 1 stone).
The player who cannot move loses.
The other player (who can still move) is the winner!
Difficulty Settings
The game has 3 difficulty settings:
Beginner: The computer makes random moves.
Amateur: The computer makes moves using a simple lookahead strategy - pick the move that
captures the most stones.
Expert: The computer makes moves using a more complex lookahead strategy - pick the move
that captures the most stones, looking several moves ahead.
In this setting, you can select the depth of the lookahead. 4 is quite good, and the default. 6 is better,
but slower. 8 is even better, but much slower.
An example why the 100 step rule is needed
Below is a position that leads to an infinite sowing loop, from your point of view:
number of stones in upper row, below stones in lower row:
00 08 00 01 00 01 00 01
02 03 04 01 02 02 01 04
you start moving counter-clockwise in the hole marked in bold, picking up the two stones. Your opponent has no
stone in his fighting board anymore.
In your first step, you pick up the two stones and drop one in the next and the other in the next hole.
In the next step you pick up the three stones and continue.
Good luck, you will never finish this move.
I asked ChatGPT to write a little script to simulate the sowing and look for
repeated
positions. And it found out that this position will repeat after 434 (!) steps of sowing.