Source code for /engineering/REVERSEM/SPOTS.HPPOriginal file SPOTS.HPP
   1 // --- Enumerate the states of a board spot -------------------------------
   2 // --- I'm doing this instead of a 'enum' to save space
   3 enum  SpotStates {
   4 			SPOT_BLANK =   0,
   5 			SPOT_BLACK,
   6 			SPOT_WHITE
   7 };
   8 
   9 
  10 // --- Go.  Place a spot on a board ---------------------------------------
  11 struct  Go {
  12    signed int  X;  // Negitive is significant.  It indicates a bounds break
  13    signed int  Y;
  14 
  15  public:
  16    void XIs( unsigned char   TheX ) { X = TheX; };
  17    void YIs( unsigned char   TheY ) { Y = TheY; };
  18 
  19    unsigned char  XIs( void ) { return X; };
  20    unsigned char  YIs( void ) { return Y; };
  21 
  22 };
  23 
  24 
  25 // --- Playing board spot class -------------------------------------------
  26 struct  Spot  {
  27 
  28    SpotStates	State;
  29 
  30   public:
  31 
  32    // Reporters
  33    BOOLEAN  IsSpotBlank( void ) { if(State==SPOT_BLANK)return(TRUE);
  34 				  else return( FALSE ); 		};
  35    BOOLEAN  IsSpotBlack( void ) { if(State==SPOT_BLACK)return(TRUE);
  36 				  else return( FALSE ); 		};
  37    BOOLEAN  IsSpotWhite( void ) { if(State==SPOT_WHITE)return(TRUE);
  38 				  else return( FALSE ); 		};
  39    BOOLEAN  IsSpot( SpotStates  TheState ) {
  40 				  if(State==TheState)return(TRUE);
  41 				  else return( FALSE ); 		};
  42    BOOLEAN  IsOther( SpotStates TheState ) {
  43 				  if((State==SPOT_WHITE)&&(TheState==SPOT_BLACK))
  44 				     return(TRUE);
  45 				  if((State==SPOT_BLACK)&&(TheState==SPOT_WHITE))
  46 				     return(TRUE);
  47 				  return( FALSE );
  48 									};
  49    void       Is( SpotStates TheState ) { State = TheState; };
  50    SpotStates Is( void ) { return State; };
  51 
  52    // Set
  53    void     SpotIsBlack( void ) { State = SPOT_BLACK; };
  54    void     SpotIsWhite( void ) { State = SPOT_WHITE; };
  55    void     SpotIsBlank( void ) { State = SPOT_BLANK; };
  56    void     SpotIs( SpotStates  TheState ) { State = TheState; };
  57    void     FlipSpot(    void ) {
  58 				  if ( State == SPOT_BLACK ) State = SPOT_WHITE;
  59 				  else State =  SPOT_BLACK;
  60 				};
  61 
  62 
  63 };
  64