Triple Town Player Protocol
A Triple Town player is implemented as a server that accepts HTTP requests containing a payload (if any) in XML format and that responds with in XML format. There are two kinds of queries to the server:
Variant —
Allows the server to report which variant of the game it supports. Move —
Asks the server to make a move.
The queries can be interleaved, and successive Move queries may or may not correspond to a single game. In particular, the server may be used for multiple games at a time.
1 Variant
A player is initially queried with GET at the URL /variant. The server must respond with a <variant> element whose value attribute is either "basic" or "extended".
For example, a player that supports only the basic game could respond with
<variant value="basic"/> |
2 Move
To let a player make a move, the player is queried with POST at the URL /move. The content of the request is the current game state, which is supplied as XML containing a <game> element.
The <game> element contains three elements (in order):
A <board> element.
The <board> element which contains six <row> elements.
The first <row> element contains five <cell> elements, while each of the remaining five <row> elements contains six <cell> elements.
Each <cell> element has a tile attribute whose value is one of the following:
"blank"
"grass"
"bush"
"tree"
"hut"
"house"
"mansion"
"castle"
"floating-castle"
"triple-castle"
(Extended game) "bear"
(Extended game) "ninja-bear"
(Extended game) "tombstone"
(Extended game) "church"
(Extended game) "cathedral"
(Extended game) "chest"
(Extended game) "large-chest"
(Extended game) "rock"
(Extended game) "mountain"
A <current> element.
The <current> element has a tile attribute whose value is one of the following:
"grass"
"bush"
"tree"
"hut"
"crystal"
"imperial-bot"
(Extended game) "bear"
(Extended game) "ninja-bear"
A <storehouse> element.
The <storehouse> element has a tile attribute whose value is like the <current> element, except that the tile attribute value can also be "none".
The player’s response must be an XML document of one the following forms:
A <place> element with row and column attributes, which indicates that the current tile should be placed on the board at the given location. The value of each row and column attribute should be "0", "1", "2", "3", "4", or "5", and one or the other value must be non-"0".
A <store> element, which indicates that the current tile should be placed in the storehouse.
A <collect> element with row and column attributes like <place>, where a "chest" or "large-chest" tile is on the current board at the given location.