-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgamelogic.h
75 lines (59 loc) · 1.17 KB
/
gamelogic.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
64
65
66
67
68
69
70
71
72
73
74
75
#ifndef GAMELOGIC_H_
#define GAMELOGIC_H_
#include "definitions.h"
#include <vector>
struct Point
{
int x;
int y;
};
class GameLogic
{
public:
enum class State
{
EMPTY,
BLACK,
WHITE
};
enum class GameLevel
{
EASY,
MODERATE,
HARD
};
enum class Player
{
BLACK,
WHITE
};
size_t Size();
//getters/setters
bool PlayerMoved()const;
bool PieceSelected()const;
void setLevel(GameLevel selected);
Player CurrentPlayer()const;
//returns true if all pieces have been placed
bool allPiecesPlaced();
int RemainingPiecesBlack()const;
int RemainingPiecesWhite()const;
//methods
void togglePlayer();
bool selectPiece(Point &p);
bool selectTarget(Point &p);
//init the game, resettin board
void init();
//returns the status of game: false for gameover
bool isGameOver();
State board[5][5];
Point source,target;
private:
Player currentPlayer;
GameLevel level;
size_t boardSize;
bool pieceSelected;
bool playerMoved;
int remainingPiecesBlack;
int remainingPiecesWhite;
};
#endif