Comments to: jsteckli@os.inf.tu-dresden.de

Your assignment is to develop a computer player for the Kalah game.
The code archive you get includes everything you need to get
started. It should compile and run on most Linux distributions and on
Mac OS X, although we only officially support the Ubuntu configuration
in the computer pool. If you want to work on your own machine, you
need a reasonably modern C compiler and environment with C99 and UNIX
03 support. With gcc or LLVM's clang you should be fine.

The rules of the game are explained in Wikipedia:
http://en.wikipedia.org/w/index.php?title=Kalah&oldid=470945773

The code archive you received includes a Makefile to compile
everything. The code is commented and you are advised to read through
the example player code and the relevant header files. The command
"make help" tells you about the supported build targets. A plain
"make" will compile everything.

Once compiled, you get three binaries:

- The Master Control Program (MCP) allows two computer programs to
  play against each other. The MCP orchestrates the game by sending
  the current game state to the players and receiving their moves. The
  MCP makes sure the rules are obeyed and the players behave.
- An example player, which allows you to play the game yourself with
  keyboard input.
- An empty file my-player.c where you should develop your game playing
  algorithm. Look at the example player to learn how you receive the
  game state from the MCP and how to send your own move back. You may
  copy code from the example player, otherwise all player code has to
  be written by you. You may not use code from the MCP. (That's why
  the interesting bits of the MCP are obfuscated by delivering them in
  assembler code.)

Use "make run" to start your player against the example player, so you
can play the game against the computer.

The official check whether you pass the assignment and also the
tournament is performed under a time and memory limit for your
player. You may use 1GB of memory and up to 60 seconds of think time
for one move (multiple threads are allowed, fork()ing is not). These
limits are enforced by the MCP. You can test your player under these
conditions using "make fight".

If you implement a long-running algorithm in your player, you may
react to the SIGXCPU signal. The MCP sends this signal when the 60
second think timer has expired. If you react to this signal, you get
one extra second to report your move to the MCP before it SIGKILLs
you.


== DEBUGGING ==

If you pass -d to the MCP, debug mode is enabled. This prints command
lines for attaching GDB to players.

To check for memory-related errors, you can pass -V memcheck to gdb to
execute each player under Valgrind with its memcheck tool. Other tools
work as well. By default valgrind will attach to both players. With
the -p option you can limit valgrind to player 1 or -1.

== TROUBLESHOOTING ==

You cannot compile this code? Send a mail describing your error
(together with uname -a output) to jsteckli@os.inf.tu-dresden.de
