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