-
Notifications
You must be signed in to change notification settings - Fork 0
/
CPlayer.h
87 lines (73 loc) · 2.02 KB
/
CPlayer.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
76
77
78
79
80
81
82
83
84
85
86
#ifndef COPPONENT_H
#define COPPONENT_H
#include "COLOR.h"
#include "CMoveList.h"
#include <vector>
using namespace std;
class CCommand;
class CGameSession;
class CPiece;
class CKing;
class CBoard;
/**
* Class representing an abstract player
*/
class CPlayer {
public:
CPlayer();
virtual ~CPlayer();
/**
* abstract method to get move from player
* @param gS reference to instance of a game
* @param cliSocket Socket to read move from
* @return Move received from player
*/
//virtual CMyMove getMove(const CGameSession & gS,int cliSocket=-1) = 0;
/**
* Returns this player's color
* @return Color of the player
*/
COLOR getPlayerColor() const;
/**
* Prints player's color into given ostream
* @param os ostream to print into
*/
void printPlayerColor(ostream & os) const;
/**
* Sets color to this player
* @param col Color to be set
*/
void setPlayerColor(COLOR col);
/**
* Finds all figures of this player
* @param board reference to a chessboard
*/
void findAllFigures(const CBoard & board);
/**
* gets command from user
* @param gS reference to instance of a game
* @return command received from user
*/
virtual CCommand getCommand(const CGameSession & gS) = 0;
/**
* Checks whether this player's king is in check
* @param gS reference to instance of a game
*/
bool kingIsChecked(const CGameSession & gS) const;
/**
* Sets given king to this player
* @param k king to be set
*/
void setKing(CKing * k);
/**
*returns this player's socket
*/
virtual int getSocket() const;
//protected:
COLOR playerColor; ///< color of the player
vector<CPiece*>figuresVec; ///< vector of all figures belonging to this user
CMoveList allMoves; ///< All possible moves to be done by the player
CKing * playersKing; ///< pointer to player's king
friend CGameSession;
};
#endif /* COPPONENT_H */