Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 15 / Chess / Figures / King / King.cpp
blob: 9d323f3353458335a4f3488e7093927d51b6ce53 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include "King.h"
#include <cmath>

King::King(bool isWhite) : Figure(isWhite)
{}
bool King::canBeMoved(size_t currentX, size_t currentY, size_t destX, size_t destY) const
{
	return abs((int)currentX - (int)destX) <= 1 && abs((int)currentY - (int)destY) <= 1;
}
void King::print() const
{
	if (getIsWhite())
		std::cout << '%';
	else
		std::cout << '$';
}