Initial commit
[cartagena.git] / lib / html / .svn / text-base / interface.html.svn-base
1 <html>
2 <head>
3 <title>Cartagena Interface</title>
4 </head>
5 <body>
6
7 <h1><a href="index.html">Cartagena</a> Computer Interface</h1>
8
9 <h2>Changes</h2>
10 <table cellpadding="3">
11
12 <tr valign="top">
13 <td>16 October 2008</td>
14 <td>Another slight tweak. Introduced notation for the card played for an advance move. </td>
15 </tr>
16
17 <tr valign="top">
18 <td>25 September 2008</td>
19 <td>Slightly changed the interface description: different file format, and program now has 15 seconds to report a single action, rather than 30 seconds for all three actions. </td>
20 </tr>
21
22 <tr valign="top">
23 <td>4 April 2008</td>
24 <td>Initial version</td>
25 </tr>
26 </table>
27
28 <p>The game will be played between two and six players. </p>
29
30 <p>Each player in Cartagena has up to three actions (advance or retreat moves) during their turn: your program will return just one of these actions. </p>
31
32 <p>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: this is likely to end with the previous actions taken during this turn. Your program will then have 15 seconds to report its next action on standard output. </p>
33
34 <p>The format of the input is as follows. The first line will have a single digit, giving the number of players. The next portion will state the layout of the board, from start to finish. Subsequent lines will give the moves played so far in the game (maximum of three consecutive actions by any player). Next will be a single line giving the number of the player whose turn is next. The final set of lines will be the cards in your hand (in an arbitrary order). </p>
35
36 <p>Postions are numbered consequetively from the start, with zero-based numbering. The cell is location 0. The boat is always the last position (number 37 in a standard game).</p>
37
38 <p>Players are numbered with one-based numbering: the first player to go is Player 1, the second is Player 2, and so on.</p>
39
40 <p>Each move will be in the format <br>
41 <code>&lt;player number&gt; &lt;location moved from&gt; &lt;location moved to&gt; &lt;card played&gt;</code><br>
42 (with a single space between the fields). The <code>&lt;card played&gt;</code> field is always missing for retreat moves, is required for advance moves into the boat, and is optional for other advance moves.</p>
43
44 <p>It may be that a player takes fewer than their three allowed actions in their turn. There are no additional spaces or blank lines in the file.</p>
45
46 <p>Here is an example of a valid input file:</p>
47
48 <pre>3
49 cell
50 skull
51 hat
52 keys
53 gun
54 bottle
55 dagger
56 hat
57 gun
58 keys
59 skull
60 bottle
61 dagger
62 dagger
63 gun
64 hat
65 bottle
66 skull
67 keys
68 hat
69 keys
70 bottle
71 gun
72 skull
73 keys
74 keys
75 skull
76 hat
77 bottle
78 gun
79 dagger
80 bottle
81 skull
82 gun
83 dagger
84 keys
85 hat
86 boat
87 1 0 4
88 1 0 3 keys
89 1 4 3
90 2 0 4
91 2 4 3
92 2 0 2
93 3 0 5
94 3 5 2
95 3 0 4
96 1 0 5 bottle
97 2
98 hat
99 skull
100 hat
101 </pre>
102
103 <p>(Note that in this example, player 1 elected to take only one of their three actions for their second turn. It is now player 2's turn.)</p>
104
105 <p>The output of your program will be the actions taken in your turn, in the same format as specified in the input file: one action per line, in the format <br>
106 <code>&lt;player number&gt; &lt;location moved from&gt; &lt;location moved to&gt; &lt;card played&gt;</code> (<code>&lt;card played&gt;</code> is optional for advance moves that are not into the boat).</p>
107
108 <p>Player programs 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.</p>
109
110 <p>The player's program must be named <code>runme</code>; it may be a binary executable or a driver shell script that starts up the actual program. It will be invoked as<br>
111
112 <pre> ./runme</pre><br>
113
114 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 <br>
115
116 <pre> support/...</pre></p>
117
118 <p>The program is run once for every move and then terminates; the current state will be passed to the program on standard input. Persistent inter-move state may be kept in the <code>support/</code> 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 30 seconds (real or "wall clock" time), the program will be terminated forcibly, and lose the game. </p>
119
120 <p>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.</p>
121
122 </body>
123 </html>