summaryrefslogtreecommitdiff
path: root/ver0/ttt.h
diff options
context:
space:
mode:
authorScott Gasch <[email protected]>2016-06-01 19:41:17 -0700
committerScott Gasch <[email protected]>2016-06-01 19:41:17 -0700
commit6d38eb746e86589e3b8fa10ba37d206af5eb7ebf (patch)
tree0d84c8901ff5df4dff2386e55b454c9001d1582d /ver0/ttt.h
Initial checking of tic tac toe minimax tutorial code.
Diffstat (limited to 'ver0/ttt.h')
-rw-r--r--ver0/ttt.h48
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_ */