-
Notifications
You must be signed in to change notification settings - Fork 0
/
Game.h
54 lines (44 loc) · 1.04 KB
/
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
#ifndef GAME_H_
#define GAME_H_
#include "GameMove.h"
#include "Player.h"
#include "Board.h"
#include <queue>
#include <string>
enum GameState {
PLAYING, DRAW, WIN
};
class Player;
struct PlayerNode {
PlayerNode* next;
Player* player;
PlayerNode(Player* player) {
this->player = player;
this->next = nullptr;
}
};
class Game {
private:
Board *board;
GameState currentState;
int line;
PlayerNode* players;
GameMove playerMove();
void clearScreen();
bool checkLine(BoardCell& cell, int row, int column, int rowLimit, int columnLimit,
int rowPlus, int columnPlus);
bool checkLine(GameMove& move, int dRow, int dColumn);
public:
Game(int boardSize, int line);
Game(const Game& game);
virtual ~Game();
void run();
void switchPlayer();
std::vector<GameMove> getPossibleMoves();
Board* getBoard();
Player* getCurrentPlayer();
bool makeMove(GameMove& move);
bool unmakeMove(GameMove& move);
bool hasWon(GameMove& lastMove);
};
#endif