Cute Chess  0.1
seirawanboard.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 SEIRAWANBOARD_H
20 #define SEIRAWANBOARD_H
21 
22 #include "westernboard.h"
23 
24 namespace Chess {
25 
46 class LIB_EXPORT SeirawanBoard : public WesternBoard
47 {
48  public:
50  SeirawanBoard();
51 
52  // Inherited from WesternBoard
53  virtual Board* copy() const;
54  virtual QString variant() const;
55  virtual QString defaultFenString() const;
56 
57  protected:
60  {
61  Hawk = King + 1,
62  Elephant
63  };
64 
65  // Inherited from WesternBoard
66  virtual bool variantHasDrops() const;
67  virtual bool variantHasChanneling(Side side, int square) const;
68  virtual bool variantHasOptionalPromotions() const;
69  virtual QList< Piece > reservePieceTypes() const;
70  virtual void addPromotions(int sourceSquare,
71  int targetSquare,
72  QVarLengthArray<Move>& moves) const;
73  virtual bool vSetFenString(const QStringList& fen);
74  virtual bool parseCastlingRights(QChar c);
75  virtual QString vFenString(FenNotation notation) const;
76  virtual QString lanMoveString(const Move& move);
77  virtual QString sanMoveString(const Move& move);
78  virtual Move moveFromSanString(const QString& str);
79  virtual Move moveFromLanString(const QString& str);
80  virtual void vMakeMove(const Move& move,
81  BoardTransition* transition);
82  virtual void vUndoMove(const Move& move);
83  virtual void generateMovesForPiece(QVarLengthArray<Move>& moves,
84  int pieceType,
85  int square) const;
86  private:
87  QMap<int, int> m_squareMap;
88  void insertIntoSquareMap(int square, int count = 0);
89  void updateSquareMap(const Move& move, int increment);
90  enum direction { forward, backward };
91  /*
92  * This method converts reserve piece types into/from
93  * corresponding "virtual" helper piece types. Used for
94  * disambiguation of channeling after castling towards GUI.
95  */
96  static int rookSquareChanneling(int promotion, direction d);
97 };
98 
99 } // namespace Chess
100 #endif // SEIRAWANBOARD_H
FenNotation
Definition: board.h:93
An internal chessboard class.
Definition: board.h:57
A board for western chess variants.
Definition: westernboard.h:40
A board for S-Chess (a.k.a. Seirawan Chess)
Definition: seirawanboard.h:46
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
SeirawanPieceType
Definition: seirawanboard.h:59