gmptogtp

gmptogtp — Adapter from Go Text Protocol to Go Modem Protocol.

Synopsis

gmptogtp [-baud n] [-color black | white ] [-config file] [-device serial] [-flow rtscts | xonxoff | none ] [-simple] [-size n] [-verbose] [-wait] [program]

gmptogtp -list

gmptogtp -help

gmptogtp -version

Description

Go Text Protocol adapter program for playing games using the Go Modem Protocol over a serial line.

If a program argument is given, the given program is run as a child process and expected to communicate via GMP through its standard input and output. For using a serial device, an implementation of the Java Communications API should be installed (rxtx is a version supporting Unix). Note that GMP is an asynchronous protocol, commands can be sent by both sides at any time, while GTP is synchronous. This problem is resolved in the following way: A separate thread always listens to the serial device, acknowledges received GMP commands immediately, and puts them on an internal queue. GTP commands that need to receive a command from GMP (e.g. genmove) check, if such a command is already on the queue, and wait for a new command otherwise. If an unexpected GMP command was received, the GTP command will return with an error; subsequently only a GTP command that corresponds to the GMP command will succeed. GTP commands that are waiting for a GMP command can be interrupted with the special comment line # interrupt used by GoGui to interrupt commands.

Options

-baud n

Speed of serial device (default 2400).

-color black | white

Color of the modem player.

-config file

Read command line options and arguments from file.

-device serial

Serial device name.

-flow rtscts | xonxoff | none

Flow control for serial device. Possible values are hardware control (RTS/CTS), software control (XON/XOFF), or no control. Default: RTS/CTS.

-help

Display help and exit.

-list

List all serial devices and exit.

-simple

Use simple version of the Go Modem Protocol, as defined in the Appendix A in Call For Participation to the FJK Computer Go Tournament 2000.

-size n

Board size (default 19).

-verbose

Print debugging messages.

-version

Print version and exit.

-wait

Wait for other side to send the first newgame command.

GTP Extensions

gogui_interrupt

Indicate interrupt ability for GoGui.

gogui_title

Return a title for GoGui.

gmp_queue

Print received queued commands, which have already been acknowledged.

gmp_talk text

Send text as talk characters. If no argument is given, all received talk is returned and the received talk buffer is cleared.

Examples

List serial ports

Test, if GmpToGtp can see serial ports:


gmptogtp -list

Test GNU Go's GMP mode

GNU Go can communicate via GMP over standard input and output. It does not make much sense to use it with GmpToGtp that way, because GNU Go implements GTP directly, but it can be used to test GNU Go's GMP mode without needing a real serial port:


gmptogtp -color white -verbose "gnugo --mode gmp"

or with a graphical display:


gogui -program "gmptogtp -color white -verbose \"gnugo --mode gmp\""

Play game between a program and the serial line with graphical display

Use a combination between GmpToGtp, TwoGtp and GoGui to play a game between a Go engine (GNU Go as black) on the first serial port with 2400 baud. Note that the colors are fixed by the command line options, they cannot be negotiated. Other options to gmptogtp that might be necessary are -flow and -simple.


GNUGO="gnugo --mode gtp"
GMPTOGTP="gmptogtp -color white -device /dev/ttyS0 -baud 2400 -verbose"
TWOGTP="twogtp -black \"$GNUGO\" -white \"$GMPTOGTP\" -verbose"
gogui -auto -verbose -program "$TWOGTP"