-
Notifications
You must be signed in to change notification settings - Fork 0
/
King.h
33 lines (25 loc) · 978 Bytes
/
King.h
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
#pragma once
class CRook;
class CKing : public CPiece
{
public:
explicit CKing(EColour theColour, CBoard* pBoard, short thePosition);
virtual ~CKing(void);
virtual bool move(short sourceRow, short targetRow, short sourceColumn, short targetColumn);
bool hasCastled(ECastleType& theCastleType) { theCastleType = eCastleType; return castled; }
bool inCheckTest(short yrow, short ycolumn);
bool inCheck();
bool checkMate();
private:
virtual bool isMoveLegal(short xrow, short yrow, short xcolumn, short ycolumn);
virtual bool isMoveBlocked(short xrow, short yrow, short xcolumn, short ycolumn);
bool allLegalMovesAreInCheck(short xrow, short xcolumn);
bool isMoveTowardRook(short yrow, short ycolumn);
bool rookHasMoved();
bool hasMoved() { return moved; }
bool isMoveCastling(short xrow, short yrow, short xcolumn, short ycolumn);
CRook* getRook(EColour theColour);
bool moved;
bool castled;
ECastleType eCastleType;
};