blob: c20a3d103901e0c63e86bd345e7fe6859e8e2dd8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#ifndef _TTT_H_
#define _TTT_H_
#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)
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;
//
// 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;
#endif /* _TTT_H_ */
|