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

GNU Go Documentation

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

6.2 Basic Data Structures in the Engine

There are some basic definitions in gnugo.h which are used everywhere. The most important of these are the numeric declarations of colors. Each intersection on the board is represented by one of these:

     color              value
     EMPTY                0
     WHITE                1
     BLACK                2

In addition to these, the following values can be used in special places, such as describing the borders of eyes:

     color                     value
     GRAY (GRAY_BORDER)          3
     WHITE_BORDER                4
     BLACK_BORDER                5

There is a macro, OTHER_COLOR(color) which can be used to get the other color than the parameter. This macro can only be used on WHITE or BLACK, but not on EMPTY or one of the border colors.

GNU Go uses two different representations of the board, for most purposes a one-dimensional one, but for a few purposes a two dimensional one (see section 8. The Board Library). The one-dimensional board was introduced before GNU Go 3.2, while the two-dimensional board dates back to the ancestral program written by Man Lung Li before 1995. The API still uses the one-dimensional board, so the API functions have not changed much since GNU Go 3.0.

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