www.delorie.com/gnu/docs/gnugo/gnugo_207.html   search  
 
Buy GNU books!


GNU Go Documentation

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

20.1 The GNU Go Text Protocol

GNU Go 3.0 introduces a new interface, the Go Text Protocol (GTP). The intention is to make an interface that is better suited for machine-machine communication than the ascii interface and simpler, more powerful, and more flexible than the Go Modem Protocol.

The GTP has two principal current applications: it is used in the test suite (see section 21. Regression testing) and it is used to communicate with gnugoclient, which is not part of the GNU Go distribution, but has been used to run GNU Go on NNGS. Other potential uses might be any of the current uses of the GMP, for which the GTP might serve as a replacement. This would likely entail extension and standardization of the protocol.

A sample GTP session may look as follows:

 
  hannah 2289% ./interface/gnugo --quiet --mode gtp
  1 loadsgf regression/games/incident156.sgf 249
  =1 
  
  2 countlib C3
  =2 4
  
  3 findlib C3
  =3 C4 B3 D3 B2
  
  5 attack C3
  =5 0 
  
  owl_attack C3  
  = 1 B4
  
  3 owl_defend C3
  =3 1 B5
  
  owl_attack A2
  ? vertex must not be empty
  
  quit
  = 

By specifying `--mode gtp' GNU Go starts in the GTP interface. No prompt is used, just start giving commands. The commands have the common syntax

 
[id] command_name [arguments]

The command is exactly one line long, i.e. it ends as soon as a newline appears. It's not possible to give multiple commands on the same line. Before the command name an optional identity number can be specified. If present it must be an integer between 0 and 2^31-1. The id numbers may come in any order or be reused. The rest of the line after the command name is assumed to be arguments for the command. Empty lines are ignored, as is everything following a hash sign up to the end of the line.

If the command is successful, the response is of the form

 
=[id] result

Here `=' indicates success and id is the identity number given in the command or the empty string if the id was omitted. This is followed by the result, which is a text string ending with two consecutive newlines.

If the command fails for some reason, the response takes the form

 
?[id] error_message

Here `?' indicates failure, id is as before, and error_message gives an explanation for the failure. This string also ends with two consecutive newlines.

The available commands may always be listed using the single command help. Currently this gives the list below.

 
attack
black
boardsize
color
combination_attack
countlib
debug_influence
debug_move_influence
decrease_depths
defend
dragon_data
dragon_status
dump_stack
echo
eval_eye
final_score
findlib
fixed_handicap
genmove_black
genmove_white
get_life_node_counter
get_owl_node_counter
get_reading_node_counter
get_trymove_counter
gg_genmove
help
increase_depths
influence
is_legal
komi
level
loadsgf
move_influence
name
new_score
owl_attack
owl_defend
popgo
prisoners
quit
report_uncertainty
reset_life_node_counter
reset_owl_node_counter
reset_reading_node_counter
reset_trymove_counter
same_dragon
showboard
trymove
tune_move_ordering
version
white
worm_cutstone
worm_data

For exact specification of their arguments and results we refer to the comments of the functions in `interface/play_gtp.c'.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003