Go Text Protocol helper for engines in Golang.
Requires rooklift/sgf library.
- The app registers its
genmove()
function withgtp.StartGTP()
- The
genmove()
function receives ansgf.Board
and ansgf.Colour
- The
genmove()
function returns an SGF-formatted move, e.g.dd
- Or it can return
pass
orresign
- Other GTP commands are handled automatically by the library.
For an example of a fully functioning random-move generator constructed with this library, see random.go inside the examples
folder.
Behind the scenes, the library is generating an SGF tree of the game, and using the sgf
library for legality checking and undo functionality. The custom GTP command savesgf
can be used to dump that as a file.