Remove more CRs.
[ttt.git] / ver2 / ttt.h
1 #ifndef TTT_H_
2 #define TTT_H_
3
4 #define ALPHA_BETA_SEARCH 1
5
6 #define TRUE (1)
7 #define FALSE (0)
8
9 #define IN
10 #define OUT
11
12 typedef unsigned int BOOL;
13
14 //
15 // Constants for each state a board square can be in and a programmer
16 // defined type for these states.
17 //
18 #define X_MARK (-1)
19 #define EMPTY  (0)
20 #define O_MARK (+1)
21 #define TIE    (+2)
22 #define OPPOSITE_MARK(m) ((m) * -1)
23 #define X_OR_O(m) (((m) == X_MARK) || \
24                    ((m) == O_MARK))
25
26 typedef signed char SQUARE;
27 #define IS_SQUARE_EMPTY(x) (x == EMPTY)
28
29 //
30 // A (simple) representation of a tic tac toe position
31 //
32 #define BOARD_SIZE (3)
33
34 typedef struct _POSITION
35 {
36     SQUARE sWhoseTurn;
37     SQUARE sBoard[BOARD_SIZE][BOARD_SIZE];
38     unsigned int uNumEmpty;
39 } POSITION;
40
41 #define NUM_TO_HPOS(x)   ((x) % BOARD_SIZE)
42 #define NUM_TO_VPOS(x)   ((x) / BOARD_SIZE)
43
44 //
45 // A representation of a move in a tic tac toe game
46 //
47 typedef unsigned int COORD;
48
49 typedef struct _MOVE
50 {
51     COORD cHpos;
52     COORD cVpos;
53     SQUARE sMark;
54 } MOVE;
55
56 //
57 // Score values
58 //
59 #define INFINITY (+100)
60 #define DRAWSCORE (0)
61
62 //
63 // An assert mechanism
64 //
65 #ifdef DEBUG
66 #define ASSERT(x)       if (x)    \
67                         { ; }     \
68                         else      \
69                         { (void) _assert(__FILE__, __LINE__); }
70 #else
71 #define ASSERT(x)       ;
72 #endif /* DEBUG */
73
74 #endif /* TTT_H_ */