Mancala: simple to play, impossible [for you] to [currently] master


[ Egyptian Rules | Ware Rules | Version 2.0 | Version 1.1 ]

Mancala, originally from Africa, is one of the world's most popular board games. I have implemented two widely popular versions of the game, and it's not too hard to add more.

Egyptian Rules

EGYPTIAN MANCALA:

1. Players must select nonempty bins on their own sides, other than their goals (kalahas).
2. After selecting a bin, the player picks up all of the pieces in that bin and puts one piece per bin going around the board counterclockwise.
3. While putting the pieces down, a player should skip over her opponent's kalaha.
4. If the last piece lands in a player's own kalaha, she gets to go again.
5. If the last piece lands in an empty bin ownd by the player whose turn it is, she must put that piece into her own Kalaha. In addition,
she gets to take all the pieces in the opposite bin. 6. If a player, on her turn (or at the end of her turn), has no more pieces on her side, the other
player gets to collect all the pieces on his side and place them into his kalaha. The game is now over, and the winner is the player with the most pieces in her kalaha.
7. Tricky Rule: A player cannot make a move that will cause her opponent's side to be empty if there is another move which will not have this effect.

Wari Rules (also called Awari, Ware, Oware, ...)

WARI MANCALA:

1. Players must select nonempty bins on their own sides, other than their goals (kalahas).
2. After selecting a bin, the player picks up all of the pieces in that bin and puts one piece per bin going around the board counterclockwise, skipping Kalahas, as well as the initial bin selected (if there are enough pieces to loop around the entire board).
3. If the last piece lands in an opponent's bin, and the total number of pieces in that bin is now 2 or 3, the current player captures those pieces. Additionally, if the next bin (clockwise) is on the opponent's side, is not a kalaha, and also has 2 or 3 pieces, these are captured as well. Keep repeating this going clockwise until you reach a bin that does not have 2 or 3 pieces. The turn is now over.
4. The game is over if, at the beginning of her turn, a player has no more pieces on her side. (see rule #'s 5,6,7)
5. A player cannot make a move that will leave her opponent's side empty when that player has another move she can make. This means that you cannot capture ALL of your opponent's pieces (if you have another move), nor can you leave your opponent's bins empty if there is a move that will place some pieces onto your opponent's side.
6. When the game is over, if a player still has pieces remaining on her side, she gets to capture them. The winner is then the player with the most pieces in her kalaha at the end of the game.
7. There are situations where the game will never end. This somewhat tricky rule remedies this. There is a limit on the number of moves that can take place without a capture. This limit is equal to the number of pieces currently in play times the number of bins on each side (but not including kalahas) on the table. So, for the default settings, this will usually be 2*6=12, 3*6=18, or possibly 4*6=24 moves. After this number of moves has taken place with no capture, the remaining pieces on the table are removed and the winner is determined.

Mancala 2.0 (Text Based)

mancala2.0.4.tar.gz

This program is pretty cross-platform, as it only relies on one high-level, cross-platform library, SDL. You will need to download and install SDL before you can compile mancala. Make sure to install SDL_net, the network and sockets library, as well. I have not yet compiled this on Windows, but if you are successful, please drop me a line.

In order to run, you will have to modify the makefile, and then run make. Once compiled, try running with the --help command line option to see a list of your options. One fun game to play would be:
mancala -p1 Winner -p2 Loser -bps 3 -ppb 2 -gt W

One fun exercise is to try and write an AI for the game. A smart AI will keep in mind both the timelimit and depth limit of the search. NOTE TO CS 280 STUDENTS: if you download the files from here, you may NOT look at minimax.cc, as it contains my own implementation of the MiniMax players. Let me know if you come up with a better AI than mine, and I can include it with this package.

I never had time to finish the GUI for version 2.0. I was going to rely on GTK+ libraries, especially gtkglextmm, since they are cross-platform (although require a bit of installing and downloads under Windows), and still plan to build this GUI when I find the time. If you'd like to help, please drop me a line.

Mancala 1.1 (GUI)

In the Spring of 2002, while I was still overly obsessed with the Visitor design pattern, I wrote the first version of mancala. This was also when I was trying to make a cross-platform widget toolkit based on GLUT, that would be more extensible than GLUI. The toolkit works, and looks pretty, but the event handling is a bit too slow. Well, I used this toolkit to build the GUI system for this version (yes, every button, textbox, etc. is my own creation), and it runs nicely on newer computers with lots of memory (it runs smoothly on a 1.7 GHz Pentium M with 512 MB RAM).

The physics of the game is mostly worked out (spherical pieces in ellipsoidal holes), although the pieces don't have enough weight, and every now and then one of them flies off the board.

  • Download -- mancala1.1.0.zip
  • Windows -- Included is the file mancala.exe which will run as long as you have opengl32.dll and glu32.dll in your PATH. They are most likely already in c:\windows\system32.
    If you're thinking about recompiling the program, the best way to do this is to download and install Cygwin, making sure to install mingw and mingw-g++, as well as the opengl and win32api libraries.
  • Linux -- You will have to edit the Makefile and compile the sources. Make sure you have opengl, glu, and glut installed.
[ Top | Egyptian Rules | Ware Rules | Version 2.0 | Version 1.1 ]