The complete GTP version 2 spec can be found here: GTP 2 spec The server currently works with GTP version 1 but we highly recommend implementing version 2 as support may not be carried forward.
GTP command syntax
GTP uses the US-ANSI character set and is entirely human readable commands (this is very useful for debugging). The commands are parsed with spaces (dec 32) and delimited with either line feed or carriage return, in the case of client responses two consecutive LF or CR is required (I will use \n in all other locations for delimitation). Some servers (GoGUI) are finiky about using exactly 2 \n in the return. More and it will choke. The GTP protocol implemented as a server request client response.
Server requests are formed:
Successful Client responses formed:
Failed Client responses and errors are formed:
? error message\n\n
We currently do not implement id numbers for commands and have no intention of adding them so you do not need to support them for this competition. If you wish to be completely GTP version 2 compliant though please see the official GTP spec page for details.
GTP move syntax
Board intersections are encoded by a letter plus a number. On a 19x19 board the letters go from A to T, excluding I, from the left to the right. The numbers go from 1 to 19, from the bottom to the top. Thus the lower left corner is called A1, the lower right corner T1, the upper left corner A19, and the upper right corner T19. Smaller boards use the obvious subset of these coordinates. Larger boards, up to 25x25, are handled by extending the letters with U to Z as needed. Boards larger than 25x25 are not supported by the protocol.
A B C D E F G H J\n
9 0 X 9\n
8 0 0 X X 8\n
7 + 0 X 7\n
6 0 X X 6\n
5 0 0 0 5\n
4 0 0 4\n
3 + + X 0 3\n
2 X 0 0 2\n
1 X 0 X 1\n
` A B C D E F G H J \n\n`
The minimum commands needed to interface with our server are: name, version, protocol_version, boardsize, komi, clear_board, play, genmove. We also recommend implementing: known_command, list_commands, quit, showboard.
- name requests the name of your bot: arg (none) - response (string)
= Random Bot\n\n
- version requests the version of your bot: arg (none) - response (string)
- protocol_version requests which protocol you are implementing: arg (none) - response (int)
- boardsize sets the current boardsize up to 25x25. We only use 19 currently. arg (int) - response (none)
- komi sets the base points for white. This can be ignored unless you track the score. arg (float) - response (none)
- clear_board tells client to clear board typically for starting a new game: arg (none) - response (none)
- play tells client to play move at given location for given colour. Remove dead stones and update prisoners accordingly. arg (colour, move) - response (none)
play w F7\n
- genmove requests a move from the client for given colour. Along with all valid moves PASS and RESIGN are allowed. arg (colour) - response (move)
- known_command askes if client recognizes given command. Returns 1 if command is known 0 otherwise. arg (string) - response (bool)
- list_commands asks for a list of all known commands. arg (none) - response (string, string, …)
= name version protocol_version boardsize komi clear_board play genmove known_command list_commands quit showboard\n\n
- quit tells program to terminate. Send response before terminating. arg (none) - response (none)
- cputime asks program to return the amount of processing time in seconds as an integer or float. arg (none) - response (float or int)
- game_score is a added command that reports an ended game’s score back to the client for end user purposes. The proper response to the server is nothing. The bot is free to print the score to the console or a log for later viewing. arg (string: game score) - reponse (none)
- showboard asks program to display board. Upto client to choose how the board is displayed. Can used CR or LF just not two consecutive ones. arg (none) - response (string …)
` A B C D E F G H J\n