Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 15 / Chess / Figures / Pawn / Pawn.cpp
blob: fd04dad24d13c99534281336be25d307736e06bf (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
31
#include "Pawn.h"
#include <cmath>
Pawn::Pawn(bool isWhite) : Figure(isWhite), isFirstMove(true)
{}
bool Pawn::canBeMoved(size_t currentX, size_t currentY, size_t destX, size_t destY) const
{
	/*if (currentX != destX)
		return false;

	int diff = destY - currentY;

	if (abs(diff) > 2)
		return false;

	if (diff < 0 && getIsWhite() || diff > 0 && !getIsWhite())
		return false;

	if (!abs(diff) == 2 || isFirstMove)
	{
		return true;
	}
	return false;*/
	return false;
}
void Pawn::print() const
{
	if (getIsWhite())
		std::cout << 'P';
	else
		std::cout << 'p';
}