-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPiece.cc
More file actions
41 lines (30 loc) · 771 Bytes
/
Piece.cc
File metadata and controls
41 lines (30 loc) · 771 Bytes
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
#include <utility>
#include "Piece.h"
#include "Move.h"
#include <vector>
using namespace std;
Piece::Piece(bool white, int points, pair<int, int> position, char pieceSymbol)
: white{white}, points{points}, position{position}, pieceSymbol{pieceSymbol}, timesMoved{0} {}
bool Piece::isWhite(){
return white;
}
int Piece::getPoints(){
return points;
}
char Piece::getPieceSymbol(){
return pieceSymbol;
}
pair<int, int> Piece::getPosition(){
return position;
}
void Piece::setPosition(pair<int, int> pos){
position = pos;
}
bool Piece::hasMoved() { return timesMoved != 0; }
void Piece::incrementTimesMoved() { ++timesMoved; }
void Piece::decrementTimesMoved() {
if (timesMoved > 0) {
--timesMoved;
}
}
Piece::~Piece() {}