Cute Chess 0.1
makrukboard.h
1/*
2 This file is part of Cute Chess.
3 Copyright (C) 2008-2018 Cute Chess authors
4
5 Cute Chess is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 Cute Chess is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with Cute Chess. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19#ifndef MAKRUKBOARD_H
20#define MAKRUKBOARD_H
21
22#include "shatranjboard.h"
23
24namespace Chess {
25
78class LIB_EXPORT MakrukBoard : public ShatranjBoard
79{
80 public:
83
84 // Inherited from ShatranjBoard
85 virtual Board* copy() const;
86 virtual QString variant() const;
87 virtual QString defaultFenString() const;
88 virtual Result result();
89
90 protected:
93 {
94 Bia = Pawn,
95 Ma = Knight,
96 Khon = Bishop,
97 Rua = Rook,
98 Met = Queen,
99 Khun = King
100 };
101
103 static const unsigned SilverGeneralMovement = 256;
112 virtual int promotionRank(int file = 0) const;
120 int pieceCount(Side side = Side::NoSide,
121 int pieceType = Piece::NoPiece) const;
125 virtual int initialPlyCount() const;
130 virtual int countingLimit() const;
134 enum CountingRules {Makruk, BareKing};
139 virtual CountingRules countingRules() const;
143 void initHistory();
148 void setAllPieceCounters();
152 Result resultFromCounting() const;
156 virtual void generatePawnMoves(int sourceSquare,
157 QVarLengthArray<Move>& moves) const;
162 virtual bool insufficientMaterial() const;
163
164 // Inherited from ShatranjBoard
165 virtual void vInitialize();
166 virtual QString vFenString(FenNotation notation) const;
167 virtual bool vSetFenString(const QStringList& fen);
168 virtual bool inCheck(Side side, int square = 0) const;
169 virtual void vMakeMove(const Move& move,
170 BoardTransition* transition);
171 virtual void vUndoMove(const Move& move);
172 virtual void generateMovesForPiece(QVarLengthArray<Move>& moves,
173 int pieceType,
174 int square) const;
175
176 private:
177 QVarLengthArray<int> m_silverGeneralOffsets[2];
178 int m_promotionRank;
179 enum CountingRules m_rules;
180 bool m_useWesternCounting;
181 // Data for reversing/unmaking a move
182 struct MoveData
183 {
184 bool piecesHonour;
185 int countingLimit;
186 int plyCount;
187 int totalPlies;
188 int pieceCount[King + 1][2];
189 };
191
192 int material() const;
193};
194
195} // namespace Chess
196#endif // MAKRUKBOARD_H
Details of a board transition caused by a move.
Definition: boardtransition.h:41
An internal chessboard class.
Definition: board.h:58
A board for Makruk (Thai Chess)
Definition: makrukboard.h:79
CountingRules
Definition: makrukboard.h:134
MakrukPieceType
Definition: makrukboard.h:93
A small and efficient chessmove class.
Definition: move.h:43
static const int NoPiece
Definition: piece.h:44
The result of a chess game.
Definition: result.h:35
A board for Shatranj.
Definition: shatranjboard.h:55
The side or color of a chess player.
Definition: side.h:36
@ NoSide
No side.
Definition: side.h:45