Cute Chess  0.1
gryphonboard.h
1 /*
2  This file is part of Cute Chess.
3 
4  Cute Chess is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  Cute Chess is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with Cute Chess. If not, see <http://www.gnu.org/licenses/>.
16 */
17 
18 #ifndef GRYPHONBOARD_H
19 #define GRYPHONBOARD_H
20 
21 #include "westernboard.h"
22 #include <QStack>
23 
24 namespace Chess {
25 
46 class LIB_EXPORT GryphonBoard : public WesternBoard
47 {
48  public:
50  GryphonBoard();
51 
52  // Inherited from WesternBoard
53  virtual Board* copy() const;
54  virtual QString variant() const;
55  virtual QString defaultFenString() const;
56 
57  protected:
58  virtual void vInitialize();
59  virtual bool kingsCountAssertion(int whiteKings,
60  int blackKings) const;
61  virtual bool inCheck(Side side, int square = 0) const;
62  virtual void vMakeMove(const Move& move,
63  BoardTransition* transition);
64  virtual void vUndoMove(const Move& move);
65  virtual bool isLegalPosition();
66  virtual void generateMovesForPiece(QVarLengthArray< Move >& moves,
67  int pieceType,
68  int square) const;
69 
75  virtual int successorType(int type,
76  bool reversed = false) const;
77 
78  private:
79  int m_start;
80  int m_end;
81  QStack<Piece> m_pieceStack;
82 };
83 
84 
102 class LIB_EXPORT SimplifiedGryphonBoard : public GryphonBoard
103 {
104  public:
107 
108  // Inherited from GryphonBoard
109  virtual Board* copy() const;
110  virtual QString variant() const;
111  virtual QString defaultFenString() const;
112 
113  protected:
114  virtual void generateMovesForPiece(QVarLengthArray< Move >& moves,
115  int pieceType,
116  int square) const;
117  virtual void vMakeMove(const Move& move,
118  BoardTransition* transition);
119  virtual void vUndoMove(const Move& move);
120 
121  private:
122  int m_captures[2];
123 };
124 
125 
148 class LIB_EXPORT CircularGryphonBoard : public GryphonBoard
149 {
150  public:
153 
154  // Inherited from GryphonBoard
155  virtual Board* copy() const;
156  virtual QString variant() const;
157  virtual QString defaultFenString() const;
158 
159  protected:
160  virtual bool kingsCountAssertion(int whiteKings,
161  int blackKings) const;
162  virtual bool inCheck(Side side,
163  int square = 0) const;
164  virtual int successorType(int type,
165  bool reversed = false) const;
166 };
167 
168 
169 
186 class LIB_EXPORT ChangeOverBoard : public CircularGryphonBoard
187 {
188  public:
190  ChangeOverBoard();
191 
192  // Inherited from GryphonBoard
193  virtual Board* copy() const;
194  virtual QString variant() const;
195  virtual QString defaultFenString() const;
196 
197  protected:
198  virtual int successorType(int type,
199  bool reversed = false) const;
200  virtual void generateMovesForPiece(QVarLengthArray< Move >& moves,
201  int pieceType,
202  int square) const;
203  virtual bool isLegalPosition();
204 };
205 
206 } // namespace Chess
207 #endif // GRYPHONBOARD_H
An internal chessboard class.
Definition: board.h:57
A board for Change-Over Chess.
Definition: gryphonboard.h:186
A board for Simplified Gryphon Chess.
Definition: gryphonboard.h:102
A board for western chess variants.
Definition: westernboard.h:40
Definition: boardscene.h:29
The side or color of a chess player.
Definition: side.h:35
Details of a board transition caused by a move.
Definition: boardtransition.h:40
A small and efficient chessmove class.
Definition: move.h:42
A board for Circular Gryphon Chess.
Definition: gryphonboard.h:148
A board for Gryphon Chess.
Definition: gryphonboard.h:46