The many variants of the African game Awari are among the oldest known games of intellectual skill. This document attempts to describe a set of rules commonly used by machine players of Awari.
The rules of awari are complicated and have many variants. This discussion is based on the excellent summary of Schaeffer et al.
Awari is a two player game, played by players conventionally designated as north and south. The board, as shown,
consists of 12 pits into which a number of stones are placed. In addition, two end pits, or awari, contain stones captured by the two sides during play. Starting from the NE corner and moving counterclockwise, the pits are named by the letters a through f, first in lowercase and then in uppercase. This convention is sensible, since the fundamental sowing operation described below moves counterclockwise.
The board starts with 48 stones, and stones are never lost from the game: all 48 must always be somewhere. The state of the board at any given time is essentially just the number of stones in each pit. The players alternate moves. Each pit initially contains 4 stones, as shown above. The south player moves first.
The players alternate in sowing the stones in a pit of their choice on their side of the board. (North owns pits a-f, and south pits A-F.) A pit may be sown if it contains one or more stones: the stones are removed from the pit, and placed one at a time into subsequent pits, moving around the board in counterclockwise order. The original pit is skipped whenever it is encountered.
Thus we can sow the stones by emptying the pit to be sown and adding a stone to each other pit for each time it is hit by sowing. The last pit filled is the first pit we will examine for possible capture below.
When sowing a pit, if the last pebble placed makes a group of two or three, then that pit's stones are captured and scored by placing in the capturing player's awari. If the previous pit then contains a group of two or three stones, these stones are also captured, and so forth. Thus, the set of pits which are captured is the set of pits on the opponent's side of the board reachable by captures from the last pit sown.
The sowing of stones to capture all stones on the opponent's side of the board is known as a grand slam, clean sweep, or grand coup. Normally, a grand slam ends the game, capturing all stones remaining on the board. The rules governing the grand slam vary widely, however: Schaeffer et al lists a number of variations:
There are a number of possible outcomes of a (attempt to) move. A game will be ended by a player being unable to move, in which case the remaining stones on the board belong to the opponent. However, a player must leave the opponent with a legal move at the start of their turn, if it is possible to do so.
A game will also be ended by repetition of position. (This is generally only true of computer play. In human play, it is more common to end by agreement of both sides.) The most common rule here is that each player captures the stones on their side of the board. One popular variant, used in the 1990-1992 Computer Olympiad, is to not count the stones left on the board at the end. To keep track of repetitions, it is necessary to keep track of the set of positions seen so far.
To summarize the variant of interest here: a move in the game consists of altering the board and recording the resulting board position. Moves alternate between players.
If the sowing is impossible, or the position is a repetition of a previous one, each player claims the stones on their side of the board, and the game is over. If the opponent's pits are all empty, the player must sow a pit which leaves the opponent a move if possible.
A grand slam capture forfeits all stones still on the board at the end of the turn. A grand slam is the capture the rest of the opponent's stones.
A move can only be illegal if a move is available. An illegal move is from a pit on the wrong side of the board, a pit with no stones, or fails to feed an opponent with stones when necessary.
The game starts with the initial board, and no positions yet seen.