foolyc

auto test of Go program

auto test of go bot

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

it offers a convenient way to test the strengthen of our program.

install

downloads gogui

extract and enter the folder

1
sudo ./install.sh. -j /path/to/your/jvm/folder

for example ,my jdk path is /usr/lib/jvm/jdk1.8.0_101.

usage

gogui-twogtp -black command -white command [-alternate] [-auto] [-config file] [-debugtocomment] [-force] [-games n] [-komi komi] [-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

parameter descriptions referred to appendix I.

examples

play games

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

for program pachi, we can define something as flowing :

1
WHITE="/media/foolyc/ssd/workspace/eclipse/pachi/pachi -t _1200 threads=1,max_tree_size=1024"

play games with graphic display

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

wrapper of our network and test result

wrapper with module gtp

we can wrapper our network in python with the python module gtp, so it can communicate with gogui or other standard program and server.

this is the wrapper code(similar with interface in rocalphago/mugo/other go bot in python, actually in gtp.py, example interface code is given).

code referred to appendix II

test result

our supervisor network vs gnugo level 10 wining rate is 36/50.

as the elo rating of gnugo level 10 is 431, the Elo rating of our supervisor network (version : 91) is 809, i infer that the KGSRank of our supervisor network (version : 91) is about 3k according to the Elo vs KGSRank graph in the Alphago paper.

whole result is as flowing table:

play colorwining rate(win/loss) average score (win/loss)
black12/13112/7
white24/1 38/6.5

appendix I

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

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

appendix II

leave out….

本文由foolyc创作和发表,采用BY-NC-SA国际许可协议进行许可
转载请注明作者及出处,本文作者为foolyc
本文标题为auto test of Go program
本文链接为http://foolyc.com//2017/02/28/auto-test-of-Go-program/.