-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPiece.cpp
More file actions
45 lines (34 loc) · 1.02 KB
/
Copy pathPiece.cpp
File metadata and controls
45 lines (34 loc) · 1.02 KB
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
#include "Piece.h"
#include "ChessBoard.h"
#include <cstdlib>
using namespace std;
Piece::Piece(Type type, Colour colour) //
: type(type) , colour(colour){}
Piece::~Piece(){}
Colour Piece::getColour() const { return colour; }
Type Piece::getType() const { return type; }
bool Piece::isOnFileRank(std::string const& from, std::string const& to){
if (from[0] == to[0] || from[1] == to[1])
return true;
return false;
}
/*End of Function*/
bool Piece::isDiagonal(std::string const& from, std::string const& to){
if (abs(to[0] - from[0]) == abs(to[1] - from[1]))
return true;
return false;
}
/*End of Function*/
bool Piece::isNextTo(std::string const& from, std::string const& to){
if (abs(to[0] - from[0]) <= 1 && abs(to[1] - from[1]) <= 1)
return true;
return false;
}
/*End of Function*/
std::vector<std::string> Piece::getLegalTargets(std::string const& from, ChessBoard & board){
std::vector<std::string> vec;
return vec;
}
void Piece::addMove(){}
int Piece::getMoveCount(){return 0;}
/*END OF FILE*/