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

GNU Go Documentation

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

6.3 The board_state struct

A basic data structure in the engine is the board_state struct. This structure is internal to the engine and is defined in `liberty.h'.

     typedef unsigned char Intersection;
     struct board_state {
       int board_size;
       Intersection board[BOARDSIZE];
       int board_ko_pos;
       int black_captured;
       int white_captured;
       Intersection initial_board[BOARDSIZE];
       int initial_board_ko_pos;
       int initial_white_captured;
       int initial_black_captured;
       int move_history_color[MAX_MOVE_HISTORY];
       int move_history_pos[MAX_MOVE_HISTORY];
       int move_history_pointer;
       float komi;
       int move_number;

Here Intersection stores EMPTY, WHITE or BLACK. It is currently defined as an unsigned char to make it reasonably efficient in both storage and access time. The board state contains an array of Intersection's representing the board. The move history is contained in the struct. Also contained in the struct is the location of a ko (EMPTY) if the last move was not a ko capture, the komi, the number of captures, and corresponding data for the initial position at the beginning of the move history.

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