From 6d38eb746e86589e3b8fa10ba37d206af5eb7ebf Mon Sep 17 00:00:00 2001 From: Scott Gasch Date: Wed, 1 Jun 2016 19:41:17 -0700 Subject: Initial checking of tic tac toe minimax tutorial code. --- ver0/ttt.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 ver0/ttt.h (limited to 'ver0/ttt.h') 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_ */ -- cgit v1.3