-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGame.h
55 lines (37 loc) · 826 Bytes
/
Game.h
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
49
50
51
52
53
54
55
/**
* A definition for a game of Tic Tac Toe where a human plays against the computer
*
* Created by Rick Mercer on 2019-03-07.
* Refactored 25-April-2022
*/
#ifndef TTT_GAME_H
#define TTT_GAME_H
#include <vector>
#include <string>
using namespace std;
class Game {
private:
vector<vector<char>> board;
int size;
public:
Game();
// Use this to store a row and column
struct square {
int row;
int col;
};
string toString();
square computerMove();
void initializeBoard();
void humanMove(int row, int col);
bool squareAvailable(int r, int c);
bool stillRunning();
bool didWin(char playerChar);
bool tied();
int maxMovesRemaining();
private:
bool wonByRow(char playerChar);
bool wonByCol(char playerChar);
bool wonByDiagonal(char playerChar);
};
#endif //TTT_GAME_H