Source code for /engineering/REVERSEM/BOARD.HPPOriginal file BOARD.HPP
   1 /*--------------------------------------------------------------------------
   2 
   3   REVERSEM :
   4 
   5   UNIT     : PLAYING BOARD CLASS
   6 
   7   COPYRIGHT (C) 1994 Erich P. Gatejen  ALL RIGHTS RESERVED
   8   This is Freeware.  You may distribute it as you wish.  However, you may not
   9   distribute a modified version without my consent.
  10 
  11   Feel free to cut and paste any algorthm.
  12 
  13   NOTE: XTILE is (C) 1992, 1994 by myself.  It is NOT freeware.  You may use
  14 	it for personal projects, but otherwise, it is not to be distributed
  15 	outside this REVERSEM package.  (Contact me if you wish to do
  16 	otherwise)
  17 
  18 ---------------------------------------------------------------------------*/
  19 
  20 // --- Playing board class ------------------------------------------------
  21 class  Board {
  22 
  23    BOOLEAN  ValidNorth( void );
  24    void     FlipNorth(  void );
  25    BOOLEAN  ValidSouth( void );
  26    void     FlipSouth(  void );
  27    BOOLEAN  ValidEast ( void );
  28    void     FlipEast  ( void );
  29    BOOLEAN  ValidWest ( void );
  30    void     FlipWest  ( void );
  31    BOOLEAN  ValidNorthEast( void );
  32    void     FlipNorthEast(  void );
  33    BOOLEAN  ValidNorthWest( void );
  34    void     FlipNorthWest(  void );
  35    BOOLEAN  ValidSouthEast( void );
  36    void     FlipSouthEast(  void );
  37    BOOLEAN  ValidSouthWest( void );
  38    void     FlipSouthWest(  void );
  39 
  40    // Dump for the go.  Let's trade some space for time
  41    static   Go	    TheGo;
  42 
  43    // Which player 'owns' the board
  44    // This will provide a speed benifit, as well.
  45    static   SpotStates	Player;
  46 
  47    // Finally, there is an evaluation boards.  They contain the general
  48    // evaluation point values for both Player and Opponant
  49    static int	  PlayerVal[BOARDXSIZE][BOARDYSIZE];
  50    static int	  OpponantVal[BOARDXSIZE][BOARDYSIZE];
  51 
  52 
  53  protected:
  54    // Also, we will remeber the BRAIN level for the evaluations
  55    static   BRAIN	BrainLevel;
  56 
  57  public:
  58 
  59    // It has 64 spots, 8 by 8
  60    Spot	  Spots[BOARDXSIZE][BOARDYSIZE];
  61 
  62    // Constructors
  63    Board( void ) {};	      // Void constructor
  64    Board( Board *OldBoard );  // Copy
  65    Board( Spot   TheSpots[BOARDXSIZE][BOARDYSIZE] );  // Copy
  66 
  67    // Initialize board to starting pieces
  68    void	     InitBoard2Start( void );
  69 
  70    // Set the brain level
  71    void      BrainIs( BRAIN  TheLevel ) { BrainLevel = TheLevel; };
  72 
  73    // Actions
  74    void      DoGo   ( Go  GoTo, SpotStates  ThePlayer  );
  75    heuristic Evaluate(  SpotStates  ThePlayer    );
  76    heuristic WinOrLose( SpotStates  ThePlayer    );
  77    int       Count( SpotStates  ThePlayer    );
  78 
  79    // Reporters
  80    BOOLEAN   ValidGo( Go  GoTo, SpotStates  ThePlayer );
  81    BOOLEAN   MoveExists( SpotStates  ThePlayer );
  82 
  83 };
  84 
  85