#ifndef TTT_H_ #define TTT_H_ #define ALPHA_BETA_SEARCH 1 #define TRUE (1) #define FALSE (0) #define IN #define OUT typedef unsigned int BOOL; // // Constants for each state a board square can be in and a programmer // defined type for these states. // #define X_MARK (-1) #define EMPTY (0) #define O_MARK (+1) #define TIE (+2) #define OPPOSITE_MARK(m) ((m) * -1) #define X_OR_O(m) (((m) == X_MARK) || \ ((m) == O_MARK)) typedef signed char SQUARE; #define IS_SQUARE_EMPTY(x) (x == EMPTY) // // A (simple) representation of a tic tac toe position // #define BOARD_SIZE (3) typedef struct _POSITION { SQUARE sWhoseTurn; SQUARE sBoard[BOARD_SIZE][BOARD_SIZE]; unsigned int uNumEmpty; } POSITION; #define NUM_TO_HPOS(x) ((x) % BOARD_SIZE) #define NUM_TO_VPOS(x) ((x) / BOARD_SIZE) // // A representation of a move in a tic tac toe game // typedef unsigned int COORD; typedef struct _MOVE { COORD cHpos; COORD cVpos; SQUARE sMark; } MOVE; // // Score values // #define INFINITY (+100) #define DRAWSCORE (0) // // An assert mechanism // #ifdef DEBUG #define ASSERT(x) if (x) \ { ; } \ else \ { (void) _assert(__FILE__, __LINE__); } #else #define ASSERT(x) ; #endif /* DEBUG */ #endif /* TTT_H_ */