-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpiece.cpp
43 lines (33 loc) · 853 Bytes
/
piece.cpp
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
#include "piece.hpp"
// Constructor
Piece::Piece() : mHasMoved(false), mCanEnPassant(false), mColour('N'), mName('_'), mSymbol(" ") {}
// Constructor used for inherited piece classes
Piece::Piece(char colour) : mHasMoved(false), mCanEnPassant(false), mColour(colour) {}
// Methods
bool Piece::getHasMoved() {
return mHasMoved;
}
bool Piece::getCanEnPassant() {
return mCanEnPassant;
}
bool Piece::legalPieceMove(int currentRank, int currentFile, int desiredPosition[]) {
return false;
}
char Piece::getColour() {
return mColour;
}
char Piece::getName() {
return mName;
}
string Piece::getSymbol() {
return mSymbol;
}
void Piece::setCanEnPassant(bool canEnPassant) {
if (mName == 'P')
mCanEnPassant = canEnPassant;
else
mCanEnPassant = false;
}
void Piece::setHasMoved() {
mHasMoved = true;
}