-
Notifications
You must be signed in to change notification settings - Fork 2
/
game.h
63 lines (52 loc) · 1.02 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
55
56
57
58
59
60
61
62
63
#ifndef GAME_H
#define GAME_H
#include "board.h"
#include "player.h"
#include "move.h"
#include <stack>
#include <vector>
#include <string>
#include <utility>
#define TOTAL_TIME 300000000
namespace checkers
{
class GUI;
class Player;
enum ActionState {
PLAYING, BLACK_WON, WHITE_WON, DRAW, QUIT
};
struct GameState {
Board board;
ActionState action;
int move_count;
int moves_since_man;
int moves_since_capture;
int black_time;
int white_time;
};
class Game
{
public:
Game(Board&, GUI*);
~Game();
void load(char* file);
size_t countHistoryMatches(Board&);
void interpretCommand(std::string);
bool makeMove(Move&);
Player* black;
Player* white;
GameState state;
Move last_move;
private:
void ai();
bool undo();
void updateBoardHistory(Board&, Board&);
void updateState(const Board&, const Move&);
int isMovement(std::string line);
Board boards[50];
size_t board_count;
std::stack< std::pair<GameState,Move> > history;
GUI* gui;
};
}
#endif // GAME_H