-
Notifications
You must be signed in to change notification settings - Fork 0
/
draughtpiece.h
104 lines (71 loc) · 2.03 KB
/
draughtpiece.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/*
* draughtpiece.h
* The draught pieces to move on the gameboard.
*
* @author Yoan DUMAS
* @versionn 1.0
* @date 18/12/2013
*/
#ifndef DRAUGHTPIECE_H
#define DRAUGHTPIECE_H
#include <vector>
#include <string>
#include <QPixmap>
#include "rules.h"
#include "piece.h"
class DraughtPiece : public Piece
{
public:
/**
* The constructor of draught piece.
* @param inPosition, the position of the draught piece on the draught board.
* @param inColor, the color of the draught.
* @param inState, the state of the draught.
*/
DraughtPiece(const position_t & inPosition, const color_t & inColor, const state_t & inState);
/**
* Copy constructor of Draughtpiece.
* @param inDraughtpiece, the draughtpiece to copy.
*/
DraughtPiece(const DraughtPiece & inDraughtpiece);
/**
* the destructor of draught piece.
*/
virtual ~DraughtPiece();
/**
* returns the state of the draught.
* @return The state of the draught.
*/
state_t getState() const;
/**
* Changes the states of the draught.
* @param inState, the new state of the draught.
*/
void setState(const state_t & inState);
/**
* Draws the Piece
*/
virtual QPixmap * draw() const;
/**
* Returns all the positions reachable by the Piece on the draught board.
* @return The vector containg all positions reachable by the Piece.
*/
virtual std::vector<position_t> getReachablePosition() const;
/**
* Returns the value of the Piece.
* @return The value of the Piece.
*/
virtual int getValue() const;
/**
* Permits to clone the draught.
* @return The clone of the draught.
*/
Piece* Clone() const;
private:
/** The state of the draught. */
state_t state_;
/** Used to calculate the reachable positions. */
bool isReachableIter(const int & direction, const int & orientation) const;
std::vector<position_t> isReachable(const int & direction) const;
};
#endif // DRAUGHTPIECE_H