It is a genre of games that originated in Africa between the 6th and 7th century AD. It has many variations, and is still enjoyed today in Africa and many other places around the world.
I am referring to a family of games called Mancala. These are mathematical games requiring significant strategic thinking, so much so that it has been reported that in some areas of Ghana, it was customary for kings to use such games to demonstrate strategic acumen and mental dexterity. The word Mancala originates from the Arabic word naqala meaning “to move” (wikipedia).
Mancala games are believed to have been first developed by the ancient Kush Civilization of the Upper Nile when accountants and engineers there began using counters on a tablet with depressions to carry out mathematical calculations about 3600 years ago (Andy Rabagliati, www.wizzy.com). In time, such computing devices were used for recreational purposes. For this reason, the games have been dubbed the first computer games.
There are hundreds of variants of Mancala. This article looks specifically at a few in order to draw on their interesting properties. Namely, I have looked at kalah, owari and ayo.
Kalah: Rules
Mancala games share a similar count-and-capture game structure. Below is a set of rules for playing kalah.
Fig.1. Typical Mancala board configuration: Player A has played pit A3.
- Players are positioned opposite of each other, and have a set of pits each, with field pits directly in front, and a home pit at the right (see fig 1 above). There can be any number of field pits, typically 6. Field pits begin with the same number of pebbles, typically 4, and home pits start off empty.
- In turns, players empty any one of their field pits and, proceeding in an counter-clockwise direction, deposit one pebble in consecutive field pits, including those of the opponent, until the pebbles run out.
- When a player runs into their home pit, they deposit a pebble; when they run into the opponent’s home pit, they skip it.
- If the last pebble a player drops is in their home pit, that player gets another turn.
- If the last pebble a player drops falls into their field pit, and that pit is empty, then that pebble is captured, along with any pebbles in the opponent’s pit directly opposite.
- All captured pebbles are permanently kept in the home pit.
- The game ends when all the field pits belonging to one player are empty, or when one player has most of the stones, such that the opponent can never catch up.
- The winner is the player with most pebbles in all their pits at game end.
To give the reader an opportunity to try the game for themselves, I have included a compressed computer programme of kalah. There are quite a few on-line versions, but I encourage you to try this one as it is designed to implement strategic concepts discussed herein. Any bugs please feel free to let me know. To play, you may need to run it from the command line. Download compressed file here: kalah.tar
Special positions in Kalah
There are a number of special positions from which one of the players can force the game to end by playing all of the pebbles from the pits on their side of the board into their home pit. For example, suppose the board is in the following state:
0, 0, 4, 2, 2, 0
left to right. Then the player can sow from the rightmost pit with 2 to reach
0, 0, 4, 2, 0, 1.
Since the last pebble played landed in the home pit, the player gets another turn and can then continue as follows:
0, 0, 4, 2, 0, 0.
then 0, 0, 0, 3, 1, 1,
then 0, 0, 0, 3, 1, 0,
then 0, 0, 0, 0, 2, 1,
then 0, 0, 0, 0, 2, 0,
then 0, 0, 0, 0, 0, 1,
then finally 0, 0, 0, 0, 0, 0.
In this manner, a player captures all eight stones in a single turn, including some belonging to the opponent. Recognising and exploiting such patterns is critical to winning a game of kalah.
Mathematical properties
Owari: Winning Strategies
The following is based on a variant of Mancala called owari. The main difference between owari and kalah is that in owari, a player looks at the number of pebbles in the last pit where the last pebble falls; if it has 2 or 3 pebbles, and it belongs to the opponent, then the player captures those pebbles. It has some interesting properties which can be applied to many other Mancala games. These properties are discussed further.
Capt .Robert Sutherland Rattray in his book, Religion & Art in Ashanti, 1927, quoted an article written by G.T. Bennet, in which winning strategies for Mancala are discussed. Of note, Bennett studied particular sequences occurring at the end of a game, and coined them “slow-motions”. He asserts that by keeping one’s pebbles spread in many pits rather than concentrated in a few, and by playing the smaller pits, a player effectively retards the rate of passage of pebbles through his territory, and in doing so, can make the inflow greater than the outflow. This is shown in the fig. 2 below.
Fig. 2. Slow motions as described by Bennett
Source. http://ehess.modelisationsavoirs.fr/marc/publi/awele/
Bennet also defined what he called a “marching group”. He points out that when the board is sparsely filled, it is useful to notice that a set of neighbouring pits, diminishing by unity, with a unit pit leading and empty pits ahead, is a configuration that can march forward unaltered. He gave an example of the case of 2 neighbouring pits with 2 and 1 pebbles respectively, call it a 2 – 1 group. The player can move the group to the right preserving the 2 – 1 arrangement, to finally capture two pebbles in pit b, as shown in Fig. 3 below.
Fig. 3. Marching Group 2 1
Mathematical Properties
Conway’s Game of Life
In 1970, the British mathematician John Conway developed the cellular automaton called the Game of Life. It models a self-organising system whose evolution is determined by its initial state only and no other inputs. In the model, as exemplified in Fig. 4 below, each square in a grid is said to be either alive or dead – black or yellow. The rules of changing the state of any one square are based on eight of its nearest neighbours. This can be simulated by a computer programme; if 3 or more nearest-neighbours are full, the cell becomes full in the next state.
Such cellular automatons exhibit periodic patterns, for example, there are black squares with a fixed pattern, they have period 1. In contrast, there are squares which flip between the two states of black and yellow, they have a period of 2.
Fig. 4. Conway’s cellular automaton :
Source: African Fractals. Modern Computing and Indigenous Design, New Brunswick, Rutgers University Press, 1999
Interesting links have been drawn between the game of owari and the mathematical theory of autonomous living systems. In particular Ron Eglash, professor of Science and Technology Studies at the Rensselaer Polytechnic Institute, USA, showed that the owari board can be viewed as a one-dimensional cellular automaton. A marching group is replicated with a right-shift, thus a pattern with a period of 1.
Fig. 5. Owari board as an automaton
Below is a pattern with period 2 which flips between two states, 2 pebbles in one pit, or one pebble in two neighbouring pits.
Fig. 6. Two state board configuration
We can ask if predictions can be made about patterns that lead to periodic cycles. Fig. 7 shows 4 pebbles with period 3.
Fig. 7. Shows 4 pebbles with period of 3
As it turns out, we can describe a mathematical law relating the period of a pattern with periodic behaviour to its total number of pebbles.
Pebbles | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
Periods | 1 | 2 | 1 | 3 | 3 | 1 | 4 | 4, 2 |
French Mathematician André Bouchet discovered the mathematical law and the structure of the periodic patterns of the owari game (Owari I. Marching Groups and Periodical Queues, 2005, manuscript). He termed them “augmented marching groups”, since we can obtain all of them by adding one pebble to any of the pits of a marching group, including the last pit on the right side which is empty.
Fig. 8 Augmented Marching Groups By Bouchet
Ayo: Determined Positions
A “determined position” is a particular type of endgame positions studied by mathematicians Duane M. Broline and Daniel E. Loeb (The Combinatorics of Mancala-Type Games: Ayo, Tchoukaillon, and 1/pi, UMAP Journal (The Journal of Undergraduate Mathematics and its Applications), 16 (1), 1995, p. 21-36). Ayo is a more complicated Mancala game, like owari, the main characteristic is that pebbles are captured when the total number of stones in the final pit is 2 or 3. In addition, if any of the opponent’s previous pits contain two or three pebbles, they are captured as well. Determined position is when South has only one pebble in pit “B”, and North takes 2 pebbles in pit “B” and leaves one in pit “A”. This has the feature of being recursive. This means that after playing a determined position, one gets to a new determined position, as shown in fig. 9 below.
Fig. 9. Determined position recursivity property
An interesting question is; can one find the smallest number of pebbles for a “determined position” in ayo, or a “special position” discussed in kalah, for n number of pits? If s(n) is such that:
s(n) = the smallest number of pebbles for which a special/ determined position using n pits exists
What happens to s(n) as n gets larger? With n = 1, this smallest number is 2. with n = 2, it is 4. With 4 it is 6. Broline and Loeb have proved that this number has an asymptotic behaviour which is described by the formula (n ^ 2)/pi.
Fig. 10. Broline and Loeb’s proof
It is amazing where the number pi will appear!
References
1. http://www.academia.edu/2543117/Mancala_games_-_Topics_in_Mathemathics_and_Artificial_Intelligence
2. http://ehess.modelisationsavoirs.fr/marc/publi/awele/
3. www.mastersgames.com/rules/mancala-rules.htm
4. www.wizzy.com
5. Wikipedia.com
Many thanks Tapiwa!!
I have to say that the number of possible positions seems surprisingly small given this is a combinatoric expression. I would expect to find a factorial in there somewhere, rather than it simply to go linearly with most of the variables. I hope to be able to play this on a Windows computer when I track one down!
Hi Jonathan, thank you for pointing that out, I have made the necessary corrections. The formula gives an upper approximation of possible states because it includes board conditions that will never occur in a real game; for example, you can never have a board state in which all pebbles are in a single pit. As for the simulation; it has been a matter of interest in artificial intelligence and algorithm analysis since the game was developed. In algorithm analysis, developers often choose between going for aggressive win strategies, or loss minimization strategies. I have tried to incorporate the best of both worlds (to some extent) in my version, so it should prove to be a worthy adversary. Enjoy.