NAME
Game::Go::GTP - the Go Text Protocol, so another engine can be the oracle
VERSION
Version 0.01
SYNOPSIS
my $gtp = Game::Go::GTP->new(level => 2);
print $gtp->handle("boardsize 9"); # "= \n\n"
print $gtp->handle("genmove b"); # "= D4\n\n"
$gtp->run(\*STDIN, \*STDOUT);
DESCRIPTION
Enough of the Go Text Protocol for gogui-twogtp to referee a match and for gnugo --mode gtp to be talked to:
protocol_version name version list_commands known_command quit
boardsize clear_board komi play genmove undo showboard
final_score final_status_list
Why it is here
To let something from outside have an opinion. The XS-only decision left this distribution with one implementation of everything, and the two places that matters most are the hardest ones: whether a group is dead, and whether the bot plays well. An independent, mature engine answering final_status_list dead and playing a match is the only non-self-referential answer available to either question.
GNU Go is neither shipped, linked nor depended on. xt/gnugo.t runs only under GO_GNUGO, and when that is set and the binary is missing it dies rather than skipping, because a fallback that reports PASS is a failing test.
GTP's vertex format is this distribution's human notation
Columns A to T with I left out, rows numbered from the bottom. That is exactly what Game::Go::Notation's human half already does, so there is no third coordinate system here and nothing to get wrong twice.
It speaks simple ko
Not the shipped positional superko. A refereeing engine and a record of a real game may both contain a repetition this distribution's own amendment would refuse, and refusing one mid-match would look like a crash rather than a rules disagreement.
METHODS
handle
One line in, one GTP response out, including the blank line that ends it. A response without that blank line hangs every controller there is.
An unknown command is answered with ? unknown command rather than dying: a controller sends commands an engine may not have and expects to be told so.
run
The loop, on two filehandles, so a test can drive it in process.
game, bot, size, komi, level, seed, quit
SEE ALSO
Game::Go, bin/go-gtp.
AUTHOR
LNATION <email@lnation.org>
LICENSE AND COPYRIGHT
This software is Copyright (c) 2026 by LNATION <email@lnation.org>.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)