Next: GTP, Previous: Utility Functions, Up: Top
If you want to write your own interface to GNU Go, or if you want to create a go application using the GNU Go engine, this chapter is of interest to you.
First an overview: GNU Go consists of two parts: the GNU Go engine and a program (user interface) which uses this engine. These are linked together into one binary. The current program implements the following user modes:
The purpose of this Chapter is to show how to interface your own
program such as debugboard
with the GNU Go engine.
Figure 1 describes the structure of a program using the GNU Go engine.
+-----------------------------------+ | | | Go application | | | +-----+----------+------+ | | | | | | | | Game | | | | | handling | | | | | | | | | +----+-----+ | | | SGF | Move | | | handling | generation | | | | | | +----------+------------+-----------+ | | | Board handling | | | +-----------------------------------+ Figure 1: The structure of a program using the GNU Go engine
The foundation is a library called libboard.a
which provides
efficient handling of a go board with rule checks for moves, with
incremental handling of connected strings of stones and with methods to
efficiently hash go positions.
On top of this, there is a library which helps the application use
Smart Game Format (SGF) files, with complete handling of game trees in
memory and in files. This library is called libsgf.a
The main part of the code within GNU Go is the move generation
library which given a position generates a move. This part of the
engine can also be used to manipulate a go position, add or remove
stones, do tactical and strategic reading and to query the engine for
legal moves. These functions are collected into libengine.a
.
The game handling code helps the application programmer keep tracks
of the moves in a game. Games can be saved to
SGF files and then later be read back again. These are also within
libengine.a
.
The responsibility of the application is to provide the user with a user interface, graphical or not, and let the user interact with the engine.