TWOGTP(1)

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

SYNOPSIS

twogtp -black command -white command [-alternate] [-auto] [-config file] [-force] [-games n] [-komi komi] [-loadsgf] [-observer command] [-openings dir] [-referee command] [-sgffile prefix] [-size n] [-time timespec] [-verbose]

twogtp -help

twogtp -analyze file.dat [-force]

twogtp -compare file.sgf...

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)

•   loadsgf

•   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; 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_black and genmove_white 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 black program.

-compare
    Compare a list of SGF files given as arguments an exit. Works only with SGF files with alternating moves and without setup stones.

-config file
    Read command line options and arguments from file.

-force
    Overwrite existing files.

-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, the komi can be set with the komi command, or a default komi of 6.5 will be used.

-loadsgf
    See -openings.

-observer command
    Command for 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. There are two ways how the opening moves can be sent to the programs. By default, all moves and setup stones are sent as alternating play commands, so instead of forwarding the first genmove commands to the program to play, TwoGtp responds with moves from the opening and informs the programs with play commands. The advantage of this method is that it still works, if TwoGtp is used interactively with GoGui as a graphical frontend; however, it is very slow for opening files containing many moves or setup stones. Alternatively the option -loadsgf makes TwoGtp to use the loadsgf GTP command for setting up openings; this works only with option -auto. Note that TwoGtp has no handicap option yet, but openings can be used to play handicap games by creating a directory with a single opening file, containing the position with handicap stones.

-referee command
    Command for 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.

-time timespec
    Set time limits (min[+min/moves]).

-verbose
    Print debugging messages.

-version
    Print version and exit.

-white command
    Command for white program.

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 of 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.

twogtp_black command
    Send command to black player.

twogtp_observer command
    Send command to observer program.

twogtp_referee command
    Send command to referee program.

twogtp_white command
    Send command to 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"
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:

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 play, select Computer Color/Both from the Game menu in GoGui):

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