diff options
Diffstat (limited to 'ver0/ttt.h')
| -rw-r--r-- | ver0/ttt.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/ver0/ttt.h b/ver0/ttt.h new file mode 100644 index 0000000..c20a3d1 --- /dev/null +++ b/ver0/ttt.h @@ -0,0 +1,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_ */ |
