Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

HexPoints

There are three types of HexPoints: special, edges, and interior.

Special points encode special moves that do not correspond to a physical location on a hex board. These are: INVALID_POINT, RESIGN, and SWAP_PIECES. Edge points (NORTH, SOUTH, EAST, WEST) denote the edges of the board. Internal points are the interior points of the board, the number of which is controlled by the constants MAX_WIDTH and MAX_HEIGHT.

HexPoints are laid out in memory as follows:


      0   INVALID_POINT
      1   RESIGN          
      2   SWAP_PIECES     
      3   NORTH
      4   EAST
      5   SOUTH
      6   WEST
      7   1st interior point
      8   2nd interior point
      ...
      ...
      ... FIRST_INVALID
    

It is assumed that the special points (i.e. SWAP_PIECES and RESIGN) come immediately before the edge points (i.e. NORTH to WEST) which come immediately before the interior points.

The interior points are laid out as follows. The first MAX_WIDTH interior points get the name 'a1, b1, c1, ... , L1', where L is letter MAX_WIDTH-1 letters after 'a'. The next MAX_WIDTH points get a '2' suffix, then a '3' suffix, and so on, until MAX_HEIGHT is reached.

This encoding allows an 11x11 hex board to fit into 128 bits if MAX_WIDTH = 11 and MAX_HEIGHT = 11.


6 Jan 2011 Doxygen 1.6.3