KGS

An Idiot's Guide

With little understanding of what I was doing, I managed to get a bot to connect through kgsGtp and play on KGS. This page describes what I did. I use Windows.

First, I got hold of a copy of the bot, and checked that it worked and played Go.

Then I learned from one of the bot's authors how to get it to get it to play in the way suitable for the KGS event it was to enter. This was by using the command line
gnugo.exe --level 12 --mode gtp --quiet
I have no idea what any of this means.

Then I downloaded kgsGtp from the KGS web site. This was the beta version, from http://www.igoweb.org/~wms/upload/. What I downloaded was a file called kgsGtp-2.6.10-beta2.zip. I unzipped it, obtaining one file, called kgsGtp.jar.

I also downloaded and installed java version 1.5. Java version numbers are confusing. Version 1.5 is also known as version 5. Version 5 a.k.a. 1.5 is the version after 1.4. Versions 1.4 and 1.5 a.k.a. 5 are both versions of "Java 2" or JRE2.

In the directory where I had put kgsGtp.jar, I typed the command line
java -jar kgsGtp.jar
This caused it to display its help, reproduced below. There is a fuller version of the kgsGtp help here.

I studied this, and wrote (with Notepad) a configuration file, which I called config.play. I put this in the same directory as kgsGtp.jar. My config.play is shown below. It is set to put up game challenges.

In this directory, I typed the command line
java -jar kgsGtp.jar config.play
It produced an error message, indicating that my config.play had a typo in it. After correcting this, and other typos, I tried again and got a message suggesting that nothing had gone wrong. I went to another workstation (I don't know if I could have used the same one) and found that the bot had appeared in KGS's Computer Go room, put up a game challenge, been accepted, and was playing happily.

I now had a slight problem – how to disconnect it, from the first workstation, without causing it to escape a game. I solved this by waiting until it was free, accepting its invitation myself, then going to the first workstation to kill it.

Now I made a copy of config.play which I called config.tmt, and edited two lines of it. My config.tmt is shown below. It is set to wait until it is called to play in a tournament.

Afterthought

There is a setting
reconnect=t
which can usefully be added to the config file. This means that, if your engine terminates, kgsGtp will try to relaunch it. It is not mentioned in the documentation that I have read, but tests show that it does not do any harm to include it. As I am testing it on GNUGo, which does not spontaneously crash, I can't yet say whether it actually helps.

kgsGtp help text
Usage: gtpClient <properties file> [prop1=val1 [prop2=val2 ...]]
Properties:
  logFile=<file> - Log to file, -nn.log will be appended
  verbose=t|f - Verbose output

  engine=<command> - Execute the command to start the engine and 
    use engine's stdin/stdout to communicate
  gtp.in=<filename> - Read named pipe for data from engine
  gtp.out=<filename> - Write named pipe for data to engine
  engine.port=<port> - Listen at the specified TCP port for 
    connections from the engine

  server.host=<host> - Set host or IP address of KGS
  server.port=<port> - Set TCP port of KGS
  name=<name> - Set user name (required)
  password=<value> - Set password (required)
  room=<room name> - Join this room on startup
  open=t|f - Make an open game and wait for a challenge
  opponent=<name> - Play against this player only
  tournament=t|f - Wait for a touranment game

  talk=<text> - Set message we give to anybody who tries to talk to us.
  gameNotes=<text> - Set game notes that appear
  hint.cleanup=<text> - Set notes to opponent about cleanup mode
  hint.noArguing=<text> - Set message to opponent when the game can't be scored

    due to disagreement over dead stones
  rules=(japanese|chinese|aga|newzealand) - Set rule system to use
  rules.boardSize=<size> - Set board size
  rules.time=<0|m:ss|m:ss+nxm:ss|m:ss+n/m:ss> - Set time system
  -help, -usage - Show this information.

Config file for play
engine=c:/Documents and Settings/Administrator/Desktop/gnugo.exe --level 12 --mode gtp --quiet
verbose=f
server.host=goserver.igoweb.org
server.port=2379
name=gnugo3pt6
password=notmyrealone
room=Computer Go
open=t
tournament=f
talk=Good evening.  I am a bot and do not talk.
rules=chinese
rules.boardSize=9
rules.time=10:00

Config file for tournaments
engine=c:/Documents and Settings/Administrator/Desktop/gnugo.exe --level 12 --mode gtp --quiet
verbose=f
server.host=goserver.igoweb.org
server.port=2379
name=gnugo3pt6
password=notmyrealone
room=Computer Go
open=f
tournament=t
talk=Good evening.  I am a bot and do not talk.
rules=chinese
rules.boardSize=9
rules.time=10:00