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 QList< Piece > reservePieceTypes() const;
69  virtual void addPromotions(int sourceSquare,
70  int targetSquare,
71  QVarLengthArray<Move>& moves) const;
72  virtual bool vSetFenString(const QStringList& fen);
73  virtual bool parseCastlingRights(QChar c);
74  virtual QString vFenString(FenNotation notation) const;
75  virtual QString lanMoveString(const Move& move);
76  virtual QString sanMoveString(const Move& move);
77  virtual Move moveFromSanString(const QString& str);
78  virtual Move moveFromLanString(const QString& str);
79  virtual void vMakeMove(const Move& move,
80  BoardTransition* transition);
81  virtual void vUndoMove(const Move& move);
82  virtual void generateMovesForPiece(QVarLengthArray<Move>& moves,
83  int pieceType,
84  int square) const;
85  private:
86  QMap<int, int> m_squareMap;
87  void insertIntoSquareMap(int square, int count = 0);
88  void updateSquareMap(const Move& move, int increment);
89  enum direction { forward, backward };
90  /*
91  * This method converts reserve piece types into/from
92  * corresponding "virtual" helper piece types. Used for
93  * disambiguation of channeling after castling towards GUI.
94  */
95  static int rookSquareChanneling(int promotion, direction d);
96 };
97 
98 } // namespace Chess
99 #endif // SEIRAWANBOARD_H
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