Website Summary Files Commits Branches @commit @diff @stats
path: root / DiamondProblemAndPolymorphism / Chess / Rook.hpp
blob: 576920af3a70deb3f56c2217fc6fa4fa76be0c5f (plain) (blame)
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
#include "Figure.hpp"

class Rook : virtual public Figure
{

public:
	Rook(int xCoordinate, int yCoordinate, bool isWhite) :Figure(xCoordinate, yCoordinate, isWhite)
	{}
	
	bool Move(int xNew, int yNew);
	
	void Print();
	
};

bool Rook::Move(int xNew, int yNew);
{
	if (!isValidCoord(xNew, yNew))
		return false;
	if (!(xCoord == xNew ^ yCoord == yNew))
		return false;
	xCoord = xNew;
	yCoord = yNew;
	return true;
}

void Rook::Print()
{
	cout << 'R';
}