Trap the Cap Computer Interface

Changes

23 February 2009 Fixed the sample game file to a legal one.
7 September 2007 Updated library: now prevents moves via base without captured pieces and prevents more than three pieces on a safe position.
Changed format for moves that end on a base
31 August 2007 Changed example input file (old one was invalid)
Added notation for moves via bases
Changed time limit to 10 seconds

The game will be played between two and six players. See below for the identities of the players.

No. of playersPlayers
2A, D
3A, C, E
4A, B, D, E
5A, B, C, D, E
6A, B, C, D, E, F

Your program will be run afresh for each move it has to make. Your program will be fed the history of the game so far on standard input. It will then have 10 seconds to report its move on standard output.

The format of the input is as follows. The first line will be a single digit, giving the number of players. Subsequent lines will give the moves played so far in the game. The final line will be the dice roll for your move. Each move will be in the format
<piece moved> <location moved to>
(that's a single space between the two parts of the line). If a move is via a base, the move will be in the format
<piece moved> <base moved via> <location moved to>
If a move is to a base, the move notation may be in either form.

It may be that one player may have many consecutive moves if they roll multiple sixes. There are no additional spaces or blank lines in the file.

Here is an example of a valid input file:

3
A1 AC2
C4 B5
E1 EC5
E2 E3
A1 EC5
C4 B2
4

(Note the caputre of piece E1 by piece A1 on position EC5.)

Player program will run on a Linux machine (probably some version of Ubuntu Linux). Exact specification is unclear at the moment, but it may run on a twin-processor machine.

The player's program must be named runme; it may be a binary executable or a driver shell script that starts up the actual program. It will be invoked as

    ./runme

with the program's top-level directory as the current working directory; libraries and other support data may thus be accessed with the relative path name
    support/...

The program is run once for every move and then terminates; the current move state will be passed to the program on standard input. Persistent inter-move state may be kept in the support/ directory if desired. When the program has chosen a move, it should print the move to standard output and exit. If the program has not done so after 10 seconds (real or "wall clock" time), the program will be terminated forcibly, and lose the game.

There should be no child processes alive after the top-level process exits; the program must ensure that all its child processes have exited before the top-level process exits itself.