-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRook.cpp
More file actions
39 lines (30 loc) · 728 Bytes
/
Copy pathRook.cpp
File metadata and controls
39 lines (30 loc) · 728 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
#include "Rook.h"
Rook::Rook(int x, int y,std::string side)
{
SetPosition(x, y);
m_symbol = side == "Black" ? 'R' : 'r';
}
Rook::~Rook()
{
//dtor
}
PieceType Rook::GetPieceType(){
return rook;
}
std::vector<position_t> Rook::GetValidMoves(){
std::vector<position_t> validMoves;
int const maxDimension = 8;
for (int i = 0; i < maxDimension ; i++){
if (i == m_position.y){
continue;
}
validMoves.push_back(position_t(m_position.x, i));
}
for (int i = 0; i < maxDimension ; i++){
if (i == m_position.x){
continue;
}
validMoves.push_back(position_t(i, m_position.y));
}
return validMoves;
}