Tic-Tac-Toe 2.0
|
00001 00012 #ifndef TICTACTOE_H 00013 #define TICTACTOE_H 00014 00015 00018 #define EMPTY 0 00019 00021 #define CROSS 1 00022 00024 #define CIRCLE 2 00025 00027 #define DRAW 3 00028 00029 00030 00031 using namespace std; 00032 00039 class TicTacToe 00040 { 00041 00042 00043 public: 00044 00045 00046 TicTacToe(void); // Constructor 00047 void DrawGame(void); // Draw the game in text mode 00048 void Reset(void); // Set the game in its initial configuration 00049 char CurrentPlayer(void); // Return the mark of the current player (CROSS or CIRCLE) 00050 char Play(int NumCell); // Play a move in the cell NumCell 00051 int Undo(void); // Undo the last move 00052 char GameOver(void); // Return the state of the game (endded, draw ...) 00053 00054 00055 private: 00056 char Grid[9]; // Playground 00057 int NumMoves; // Number of moves since the beginning 00058 int History[9]; // History of the game (each move) 00059 }; 00060 00061 #endif // TICTACTOE_H 00062