Previous: The Board State, Up: API


17.4 Functions which manipulate a Position

All the functions in the engine that manipulate Positions have names prefixed by gnugo_. These functions still use the two-dimensional representation of the board (see The Board Array). Here is a complete list, as prototyped in gnugo.h:

17.5 Game handling

The functions (in see Positional Functions) are all that are needed to create a fully functional go program. But to make the life easier for the programmer, there is a small set of functions specially designed for handling ongoing games.

The data structure describing an ongoing game is the Gameinfo. It is defined as follows:

     
     typedef struct {
       int       handicap;
     
       int       to_move;            /* whose move it currently is */
       SGFTree   game_record;        /* Game record in sgf format. */
     
       int       computer_player;    /* BLACK, WHITE, or EMPTY (used as BOTH) */
     
       char      outfilename[128];   /* Trickle file */
       FILE      *outfile;
     } Gameinfo;

The meaning of handicap should be obvious. to_move is the color of the side whose turn it is to move.

The SGF tree game_record is used to store all the moves in the entire game, including a header node which contains, among other things, komi and handicap.

If one or both of the opponents is the computer, the field computer_player is used. Otherwise it can be ignored.

GNU Go can use a trickle file to continuously save all the moves of an ongoing game. This file can also contain information about internal state of the engine such as move reasons for various locations or move valuations. The name of this file should be stored in outfilename and the file pointer to the open file is stored in outfile. If no trickle file is used, outfilename[0] will contain a null character and outfile will be set to NULL.

17.5.1 Functions which manipulate a Gameinfo

All the functions in the engine that manipulate Gameinfos have names prefixed by gameinfo_. Here is a complete list, as prototyped in gnugo.h: