www.delorie.com/gnu/docs/gnugo/gnugo_86.html   search  
Buy GNU books!

GNU Go Documentation

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.1 Board Data structures

The basic data structures of the board correspond tightly to the board_state struct described in See section 6.3 The board_state struct. They are all stored in global variables for efficiency reasons, the most important of which are:

int           board_size;
Intersection  board[MAXSIZE];
int           board_ko_pos;

float         komi;
int           white_captured;
int           black_captured;

Hash_data     hashdata;

The description of the Position struct is applicable to these variables also, so we won't duplicate it here. All these variables are globals for performance reasons. Behind these variables, there are a number of other private data structures. These implement incremental handling of strings, liberties and other properties (see section 19. Incremental Algorithms in Reading). The variable hashdata contains information about the hash value for the current position (see section 14.2 Hashing of Positions).

These variables should never be manipulated directly, since they are only the front end for the incremental machinery. They can be read, but should only be written by using the functions described in the next section. If you write directly to them, the incremental data structures will become out of sync with each other, and a crash is the likely result.

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003