Cute Chess  0.1
oukboard.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 OUKBOARD_H
20 #define OUKBOARD_H
21 
22 #include "makrukboard.h"
23 
24 namespace Chess {
25 
48 class LIB_EXPORT OukBoard : public MakrukBoard
49 {
50  public:
52  OukBoard();
53 
54  // Inherited from MakrukBoard
55  virtual Board* copy() const;
56  virtual QString variant() const;
57  virtual QString defaultFenString() const;
58 
59  protected:
62  {
63  Fish = Pawn,
64  Horse = Knight,
65  Pillar = Bishop,
66  Boat = Rook,
67  Maiden = Queen,
68  King
69  };
70 
71  // Inherited from MakrukBoard
72  virtual CountingRules countingRules() const;
73  virtual bool parseCastlingRights(QChar c);
74  virtual QString vFenString(FenNotation notation) const;
75  virtual bool vSetFenString(const QStringList& fen);
76  virtual bool inCheck(Side side, int square = 0) const;
77  virtual void generateMovesForPiece(QVarLengthArray<Move>& moves,
78  int pieceType,
79  int square) const;
80  virtual void vMakeMove(const Move& move,
81  BoardTransition* transition);
82  virtual void vUndoMove(const Move& move);
83 
84  private:
85  void updateCounter(Move m, int increment);
86  const QMap<OukPieceType, int>m_initialSquare[2];
87  const struct
88  {
89  OukPieceType type;
90  int offset;
91  } m_initialOffsets[3];
92  QMap<OukPieceType, int> m_moveCount[2];
93 };
94 
95 
106 class LIB_EXPORT KarOukBoard : public OukBoard
107 {
108  public:
110  KarOukBoard();
111 
112  // Inherited from OukBoard
113  virtual Board* copy() const;
114  virtual QString variant() const;
115  virtual QString defaultFenString() const;
116  virtual Result result();
117 };
118 
119 } // namespace Chess
120 #endif // OUKBOARD_H
OukPieceType
Definition: oukboard.h:61
FenNotation
Definition: board.h:93
An internal chessboard class.
Definition: board.h:57
Definition: boardscene.h:29
A board for Ouk Chatrang (Ouk Khmer, Cambodian Chess)
Definition: oukboard.h:48
A board for Makruk (Thai Chess)
Definition: makrukboard.h:78
The side or color of a chess player.
Definition: side.h:35
The result of a chess game.
Definition: result.h:34
Details of a board transition caused by a move.
Definition: boardtransition.h:40
A board for Kar Ouk.
Definition: oukboard.h:106
A small and efficient chessmove class.
Definition: move.h:42
CountingRules
Definition: makrukboard.h:130