The Game of Kalah

Due: January 10th, 11:59PM







Objective: Design and program a computer player for the game of Kalah. Your final product will be entered into the class tournament to determine your grade on the project (see below for more information on the tournament format).

Teamwork: You can work in teams of two for this program, although if you prefer you can work alone. Each individual in a group is allowed to enter one program prefixed with their username. Thus if kinley and smith were a group, we would be allowed to submit kinley-kalah.ss and smith-kalah.ss. This will enable groups to explore different ways of constructing their computer AI.

The Game: The game of Kalah originates from the African game Mancala. A good description of the rules and play of this game is available at

The Rules

We will accept these rules as cannon for the purposes of our competition. The winner of the game is the person at the completion of the game with the most beans.

The program:

You are only required to implement a single function for this assignment (although it is certain you will need to write many more of your own choosing). The function must be called getmove and will take the current state of the board, and which player is making the next move (i.e. your program). Getmove will then return a symbol a-f specifying the move that you wish your player to make.

Every function that your write in this program should be prefaced by you username followed by a hyphen. For example, in my version of the game I would call the above function kinley-getmove(board, player). Any program having functions not conforming to this convention automatically forfeit all games in the tournament and receive the lowest possible score. The file you store your game in should again make use of this convention, thus my file would be called kinley-kalah.ss

You are allowed to refer to player numbers however you desire (I use players 0 and 1) but to ensure uniformity you should define two global variables in your program *username-firstPlayer* and *username-secondPlayer* should be defined in your program as is appropriate.

The board must be represented as follows:

�(0 ; the number of beans in player 0�s kalah
  0 ; the number of beans in player 1�s kalah
  ((6 6 6 6 6 6) ; represents the initial state for player 0
   (6 6 6 6 6 6))) ; represents the initial state for player 1
A call to getmove being passed the initial board state, 0 captures for each player with player 1 to move, would thus look as follows: (getmove �(0 0 ((6 6 6 6 6 6 ) (6 6 6 6 6 6)) 0) You may use any techniques you desire to augment the intelligence of your system.

The tournament rules:

The tournament will be conducted in world cup style. Each program will be assigned to a group of 4 or 5. Each group will be put through a round robin tournament with the winner of the group advancing to the finals. 32 programs will advance to a final tournament round where they will be seeded based on their performance in the initial round. At-Large teams, to fill out the 16, will be selected on the basis of their performance in the first round. All ties will be broken by head to head record, the average stones captured per game or a single head to head battle.

A referee program will run the tournament by loading each opponents program and asking each program for its move based on the current board state. Each player will be given 1 minutes per turn. If a player fails to make a move in the allotted time then the player forfeits the match regardless of the current score. If a player�s program performs an error than the player forfeits the match. The referee has been tested extensively and thus has final say on all decisions related to the game. However, any errors found in the referee program and reported will receive additional credit on the assignment.

Programs must be turned in by January 10th at 11:59PM. The first round will be conducted over the next two days with finalists announced Wednesday afternoon. Players advancing to the second round may modify and tweak their programs anytime up until the final round begins at 7:00PM on January 13th. The championship games will be a public event and will be announce prior to the event.

Grading:

The program is grade based on its performance in the tournament. In the case of teams, the better program will be scored.

Disclaimer:

Andy is allowed to augment and modify this document through Jan 3rd. However, there will be no changes that radically alter how the programs must be written.