Next: , Up: Libboard


15.1 Board Data structures

The basic data structures of the board correspond tightly to the board_state struct described in See The Board State. 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 Incremental Board). The variable hashdata contains information about the hash value for the current position (see Hashing).

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.