Usage of gogui-twogtp on Windows

Want to watch and/or test two computers (Go Text Protocol Engines) play the boardgame Go against each other?  Want to run 100 games, alternate sides, and control time limits, whilst storing the games in neat, numbered game files? There is a Java add-on program to GoGUI (included in the regular GoGUI download) called gogui-twogtp which allows you to do this assuming you are comfortable with command-line options and configuration files.

On Linux/Ubuntu/Windows with Cygwin, the shell script to run GoGUI-TwoGTP is simpler than Windows alone and a short example would be:

WHITE="fuego --config fuego_config.ini"
TWOGTP="gogui-twogtp -komi 6.5 -size 9 -black \"$BLACK\" -white \"$WHITE\" -time 5m -verbose -alternate -games 2 -sgffile sixpaths-fuego-fuego-02"
gogui -komi 6.5 -time 5 -computer-both -auto -program "$TWOGTP"

Note: You can set Cygwin startup directory by editing the Cygwin folder/home/.bashrc and adding a “cd” line at the end of the file such as:

cd /cygdrive/c/Users/Ero-Sennin/Desktop/go_simulations/

On Windows without Cygwin, hence without the Bash shell used in Linux/Ubuntu/Windows with Cygwin, the Windows CMD prompt invokes the gogui-twogtp Java program for playing two Go Engines (via GTP) against each other. (There is an included gogui-twogtp.cmd file with GoGUI in the bin folder but it seems to be geared toward Cygwin usage).

Below is an example using two copies of the Fuego engine on Windows in a TwoGTPEngines.cmd file (fuego_config.ini is a plain text file in the same directory as the cmd file):

REM Windows CMD Script to use the GoGUI graphical GTP interface to allow two separate GTP engines to play against each other.
REM In this case, the fuego 1.0 engine is being used, and it is competing against itself.  One instance is using a custom configuration files and one instance is
REM using the defaults for everything.

REM Define the parameters used to open the twogtp program within the gogui program.
set JAVA=C:\Program Files (x86)\Java\jre6\bin\javaw.exe
set DESKTOP_PATH=C:\Users\Ero-Sennin\Desktop
set GOGUI=%DESKTOP_PATH%\Go_Programming\gogui-1.2.3\lib\gogui.jar
set TWOGTP_JAR=%DESKTOP_PATH%\Go_Programming\gogui-1.2.3\lib\gogui-twogtp.jar
set SAVED_GAME_FILE_PREFIX=fuego-vs-conffuego
set GAMES=10
set KOMI=6.5
REM fuego.exe configuration file argument --config fuego_config.ini will affect BOTH copies of the engine even though they are completely separate EXE files.
set BLACK="%DESKTOP_PATH%\fuego-1.0\mingw\fuegomain\fuego.exe"
set WHITE="""%DESKTOP_PATH%\fuego\release\fuego-vs2010.exe --config fuego_config.ini"""
set TWOGTP="%JAVA% -jar %TWOGTP_JAR% -komi %KOMI% -size %BOARDSIZE% -black %BLACK% -white %WHITE% -time %TIME_MINUTES% -verbose -alternate -games %GAMES% -sgffile %SAVED_GAME_FILE_PREFIX%"

REM Open the program using Java Runtime Environment for Windows (javaw.exe).  Note that this command actually passes a javaw.exe instance argument to ITSELF, 
REM because both gogui and gogui-twogtp are independent Java programs.
"%JAVA%" -jar "%GOGUI%" -komi %KOMI% -time %TIME_MINUTES% -computer-both -auto -program %TWOGTP%

echo %errorlevel%

REM Analyze/Process the saved game files and generate an HTML summary file.
"%JAVA%" -jar %TWOGTP_JAR% -analyze %SAVED_GAME_FILE_PREFIX%.dat

Note the tricky triple quoting needed to use the WHITE player’s –config argument, as well as the Javaw.exe nesting (one instance takes the other as a parameter). As of the article’s writing, it appears GoGUI applies the –config argument to BOTH copies of the Fuego engine even if the parameter is only supplied to one.

At the end of the script, the -analyze command is given to generate an HTML summary file based on the data contained in the *.dat file generated for all the games played. Until the next release of GoGUI this will not give the correct results on Windows, unfortunately, but has been solved in the latest GIT repository iterations (See comment from developer below on gogui-twogtp -analyze fix).

In the above example, you can see that TWO versions of the Fuego engine are being used. Both have been compiled for Windows using the Fuego documentation, but one used MinGW and MSYS whereas the other used Microsoft Visual Studio 2010.

The Fuego configuration file is an external text file storing various Fuego.exe parameters as GTP commands. Knowing what each parameter does will allow you to customize an appropriate file for the machine you are running Fuego on. General recommendations can be found here. An example of a strong configuration file on an 8 core machine would be:

 uct_param_search number_threads 8
 uct_param_search lock_free 1
 uct_max_memory 3000000000
 uct_param_player reuse_subtree 1
 uct_param_player ponder 1
uct_param_search virtual_loss 1

If you want to use 7GB of RAM (and compiled Fuego as a 64-bit executable) then you could do:

uct_max_memory 7516192768

Fuego comes with *.sh shell scripts preconfigured to connect the engine to the Computer Go Server by invoking the client and using common configurations. On Windows, you cannot directly use these without Cygwin. If you want to use CMD, then you just need make make sure you correctly configure the Fuego –config file. The most important consideration for use of Fuego on CGOS is to make sure that the rules are correctly set, such as below:

go_param_rules capture_dead 1
go_param_rules two_passes_end_game 1
go_param_rules ko_rule pos_superko
go_param_rules allow_suicide 0
go_param_rules japanese_scoring 0
uct_param_player early_pass 0
sg_param time_mode real
Screenshot of GoGui-TwoGTP running two copies of the Fuego engine against each other

Screenshot of GoGui-TwoGTP running two copies of the Fuego engine against each other

One Response to Usage of gogui-twogtp on Windows

  1. Markus says:

    Writing to the result file was broken in gogui-twogtp 1.2.x. I already fixed it in the git repository and it should work again in the next release. The problem is that I don’t use GoGui and the command line/GTP tools on other OSes than Linux myself, so I am dependent on people testing the software on Windows, reporting bugs and submitting fixes.

Comments are closed.