gogui-twogtp

gogui-twogtp — Go Text Protocol adapter for playing games between two Go programs.

Synopsis

gogui-twogtp -black command -white command [-alternate] [-auto] [-config file] [-debugtocomment] [-force] [-games n] [-komi komi] [-handicap n] [-maxmoves n] [-observer command] [-openings dir] [-referee command] [-sgffile prefix] [-size n] [-threads n] [-time timespec] [-verbose] [-xml]

gogui-twogtp -help

gogui-twogtp -analyze file.dat [-force]

gogui-twogtp -compare file.sgf...

gogui-twogtp -version

Description

Adapter program for playing games between two Go programs supporting GTP (Go Text Protocol).

Optional observer and referee GTP Go programs can be used for observing the game and answering commands related to the final game score. TwoGtp forwards the following commands to all programs (command translation is done for protocol version 1 programs):

  • boardsize
  • clear_board
  • komi (if supported)
  • fixed_handicap
  • play
  • quit
  • scoring_system (if supported)
  • time_settings (if supported)
  • undo

The following commands are forwarded to the referee program, if existing, otherwise to first player program that implements them (Black is tried first):

  • final_score
  • final_status
  • final_status_list

The command genmove is forwarded only to the program of the corresponding color, the other programs are informed about the move with a play command. GTP extension commands implemented by exactly one of the programs are forwarded to the program. The special comment line # interrupt, used by GoGui to interrupt commands, is forwarded to all programs.

If the option -sgffile is used, the games are saved after they are finished and a result text file in table format is created with some statistics. If the program(s) support the GTP command cputime, these statistics include CPU times. The errors in the statistics are the standard errors (confidence interval 68%). They are computed by the standard deviation of the results, divided by the square root of the number of unique games, which is correct only for a sufficiently large number of games (especially if the percentage of wins is close to 0% or 100%).

Options

-alternate

Alternate colors. Black and White are exchanged every odd game; the scores saved in the results table -sgffile are still using the name Black and White as given with -black and -white.

-analyze file.dat

Analyze the result file file.dat. Creates a HTML file file.html with links to the games and summary statistics. Also creates a text file file.summary.dat, with a table row containing the most important summary statistics.

-auto

Automatically play games. Use this option if you want to run TwoGtp as a standalone program, without a program like GoGui which controls the move generation with genmove commands. If a result file already exists (as specified with -sgffile) and contains less games than specified with -games, the remaining games will be played. Use -force to overwrite existing result files.

-black command

Command for the black program.

-compare

Compare a list of SGF files given as arguments an exit.

-config file

Read command line options and arguments from the given file.

-force

Overwrite existing files.

-debugtocomment

Store all text that was written by each program to the standard error stream during the move generation in the comment properties of the SGF file.

-games n

Number of games to play (0 means no limit).

-help

Display help and exit.

-komi komi

Komi. If this option is not used, a default komi of 6.5 will be used. The komi cannot be changed at runtime. The komi GTP command will succeed if the argument has the same value as the configured komi and fail otherwise.

-handicap handicap

Number of handicap stones (default none).

-maxmoves n

Limit the maximum number of moves. Can be useful if some games would not terminate otherwise. Default is 1000. -1 means no limit.

-observer command

Command for the observer program.

-openings directory

Use openings from SGF files in the given directory. The openings will be cycled through in alphabetical order. If option -alternate is set, each opening is played twice with colors exchanged. If TwoGtp is used as a GTP engine, the opening moves will be returned to the controller as responses to the first genmove GTP commands. Note that in this case opening files with non-alternating moves or setup stones are not supported (this is currently not checked and will result in undefined behavior). In automatic mode (see -auto), there is no such restriction.

-referee command

Command for the referee program.

-sgffile prefix

Save games after they are finished with filename prefix-n.sgf (n is the game number). The results are appended to the file prefix.dat.

-size n

Board size for games. If this option is not used, the size will be set with the boardsize command, or the default size 19 will be used when option -auto is set.

-threads n

Use multi-threading. Setting the number of threads to a value greater than 1 will create multiple instances of the Go programs to play n games in parallel. Can only be used together with option -auto.

-time timespec

Set time limits (basetime[+overtime/moves]). The base time and overtime (byoyomi) can have an optional unit specifier (m or min for minutes; s or sec for seconds; default is minutes).

-verbose

Print debugging messages. This will print GTP commands and responses and text written to the standard error stream by the programs to the standard error stream. If option -threads is used only the debugging messages of the first thread are written.

-version

Print version and exit.

-white command

Command for the white program.

-xml

Save games in XML format.

GTP Extensions

gogui-interrupt

Indicate interrupt ability for GoGui. TwoGtp will forward the interrupt to both programs, with the appropriate method if they implement either gogui-interrupt or gogui-sigint. See the chapter "Interrupting Commands" in the GoGui documentation.

gogui-title

Return a title for the current game consisting of the game number (if option -sgffile was used) and the player names.

gogui-twogtp-black command

Send command to the black player.

gogui-twogtp-observer command

Send command to the observer program.

gogui-twogtp-referee command

Send command to the referee program.

gogui-twogtp-white command

Send command to the white player.

Examples

Play games

Play 100 games between GNU Go, default level, and GNU Go, level 5, on a 9x9 board, with alternating colors; save games and results to files with filename prefix gnugo5:


BLACK="gnugo --mode gtp"
WHITE="gnugo --mode gtp --level 5"
gogui-twogtp -black "$BLACK" -white "$WHITE" -games 100 \
  -size 9 -alternate -sgffile gnugo5 -auto

Analyze results

Create a HTML formatted result page of the games played in the previous section:


gogui-twogtp -analyze gnugo5.dat

Play one game with graphical display

Play one game between GNU Go, default level, and GNU Go, level 5, using GoGui as a graphical display (to start playing select Computer Color/Both from the Game menu in GoGui):


BLACK="gnugo --mode gtp"
WHITE="gnugo --mode gtp --level 5"
gogui -program "gogui-twogtp -black \"$BLACK\" -white \"$WHITE\""

Play games with graphical display

Play 100 games with same settings as in the first example, with GoGui as a graphical display (start games automatically):


BLACK="gnugo --mode gtp"
WHITE="gnugo --mode gtp --level 5"
TWOGTP="gogui-twogtp -black \"$BLACK\" -white \"$WHITE\" -games 100 \
  -size 9 -alternate -sgffile gnugo5"
gogui -size 9 -program "$TWOGTP" -computer-both -auto