3 <title>Trap the Cap Interface
</title>
7 <h1><a href=
"index.html">Trap the Cap
</a> Computer Interface
</h1>
10 <table cellpadding=
"3">
13 <td>23 February
2009</td>
14 <td>Fixed the sample game file to a legal one.
</tr>
17 <td>7 September
2007</td>
18 <td>Updated library: now prevents moves via base without captured pieces and prevents more than three pieces on a safe position.
<br>
19 Changed format for moves that end on a base
</td>
23 <td>31 August
2007</td>
24 <td>Changed example input file (old one was invalid)
<br>
25 Added notation for moves via bases
<br>
26 Changed time limit to
10 seconds
</td>
30 <p>The game will be played between two and six players. See below for
31 the identities of the players.
</p>
34 <tr><th>No. of players
</th><th>Players
</th</tr>
35 <tr align=center
><td>2</td><td>A, D
</td></tr>
36 <tr align=center
><td>3</td><td>A, C, E
</td></tr>
37 <tr align=center
><td>4</td><td>A, B, D, E
</td></tr>
38 <tr align=center
><td>5</td><td>A, B, C, D, E
</td></tr>
39 <tr align=center
><td>6</td><td>A, B, C, D, E, F
</td></tr>
42 <p>Your program will be run afresh for each move it has to make. Your
43 program will be fed the history of the game so far on standard input.
44 It will then have
10 seconds to report its move on standard
47 <p>The format of the input is as follows. The first line will be a
48 single digit, giving the number of players. Subsequent lines will
49 give the moves played so far in the game. The final line will be the
50 dice roll for your move. Each move will be in the format
<br>
51 <code><piece moved
> <location moved to
></code><br>
53 (that's a single space between the two parts of the line). If a move
54 is via a base, the move will be in the format
<br>
55 <code><piece moved
> <base moved via
> <location moved
57 If a move is to a base, the move notation may be in either form.
</p>
59 <p>It may be that one player may have many consecutive moves if they
60 roll multiple sixes. There are no additional spaces or blank lines in
63 <p>Here is an example of a valid input file:
</p>
74 <p>(Note the caputre of piece E1 by piece A1 on position EC5.)
76 <p>Player program will run on a Linux machine (probably some version
77 of Ubuntu Linux). Exact specification is unclear at the moment, but
78 it may run on a twin-processor machine.
</p>
80 <p>The player's program must be named
<code>runme
</code>; it may be a
81 binary executable or a driver shell script that starts up the actual
82 program. It will be invoked as
<br>
84 <pre> ./runme
</pre><br>
86 with the program's top-level directory as the current working
87 directory; libraries and other support data may thus be accessed with
88 the relative path name
<br>
90 <pre> support/...
</pre></p>
92 <p>The program is run once for every move and then terminates; the
93 current move state will be passed to the program on standard
94 input. Persistent inter-move state may be kept in the
95 <code>support/
</code> directory if desired. When the program has
96 chosen a move, it should print the move to standard output and
97 exit. If the program has not done so after
10 seconds (real or
"wall
98 clock" time), the program will be terminated forcibly, and lose the
101 <p>There should be no child processes alive after the top-level
102 process exits; the program must ensure that all its child processes
103 have exited before the top-level process exits itself.
</p>