Cute Chess 0.1
Chess::SeirawanBoard Class Reference

A board for S-Chess (a.k.a. Seirawan Chess). More...

#include <seirawanboard.h>

Inheritance diagram for Chess::SeirawanBoard:
Chess::WesternBoard Chess::Board

Public Member Functions

virtual Boardcopy () const
virtual QString defaultFenString () const
 SeirawanBoard ()
virtual QString variant () const
Public Member Functions inherited from Chess::WesternBoard
virtual int height () const
virtual Result result ()
virtual int reversibleMoveCount () const
 WesternBoard (WesternZobrist *zobrist)
virtual int width () const
Public Member Functions inherited from Chess::Board
 Board (Zobrist *zobrist)
virtual CoordinateSystem coordinateSystem () const
QString fenString (FenNotation notation=XFen) const
GenericMove genericMove (const Move &move) const
void initialize ()
bool isLegalMove (const Move &move)
virtual bool isRandomVariant () const
bool isRepetition (const Move &move)
bool isValidSquare (const Square &square) const
quint64 key () const
QVector< MovelegalMoves ()
void makeMove (const Move &move, BoardTransition *transition=nullptr)
Move moveFromGenericMove (const GenericMove &move) const
Move moveFromString (const QString &str)
QString moveString (const Move &move, MoveNotation notation)
Piece pieceAt (const Square &square) const
Piece pieceFromSymbol (const QString &pieceSymbol) const
QStringList pieceList (Side side) const
QString pieceString (int pieceType) const
QString pieceSymbol (Piece piece) const
int plyCount () const
int repeatCount () const
QString representation (Piece piece) const
int reserveCount (Piece piece) const
void reset ()
bool setFenString (const QString &fen)
Side sideToMove () const
QString startingFenString () const
Side startingSide () const
virtual Result tablebaseResult (unsigned int *dtm=nullptr) const
void undoMove ()
virtual Side upperCaseSide () const
virtual bool variantHasWallSquares () const
virtual ~Board ()

Protected Types

enum  SeirawanPieceType { Hawk = King + 1 , Elephant }
Protected Types inherited from Chess::WesternBoard
enum  CastlingSide { QueenSide , KingSide , NoCastlingSide }
enum  StepType { NoStep = 0 , FreeStep = 1 , CaptureStep = 2 }

Protected Member Functions

virtual void addPromotions (int sourceSquare, int targetSquare, QVarLengthArray< Move > &moves) const
virtual void generateMovesForPiece (QVarLengthArray< Move > &moves, int pieceType, int square) const
virtual QString lanMoveString (const Move &move)
virtual Move moveFromLanString (const QString &str)
virtual Move moveFromSanString (const QString &str)
virtual bool parseCastlingRights (QChar c)
virtual QList< PiecereservePieceTypes () const
virtual QString sanMoveString (const Move &move)
virtual bool variantHasChanneling (Side side, int square) const
virtual bool variantHasDrops () const
virtual QString vFenString (FenNotation notation) const
virtual void vMakeMove (const Move &move, BoardTransition *transition)
virtual bool vSetFenString (const QStringList &fen)
virtual void vUndoMove (const Move &move)
Protected Member Functions inherited from Chess::WesternBoard
virtual int captureType (const Move &move) const
virtual int castlingFile (CastlingSide castlingSide) const
int enpassantSquare () const
virtual bool hasCastling () const
bool hasCastlingRight (Side side, CastlingSide castlingSide) const
virtual bool hasEnPassantCaptures () const
virtual bool inCheck (Side side, int square=0) const
virtual bool isLegalPosition ()
virtual bool kingCanCapture () const
virtual bool kingsCountAssertion (int whiteKings, int blackKings) const
int kingSquare (Side side) const
int pawnAmbiguity (StepType type=FreeStep) const
virtual bool pawnHasDoubleStep () const
void removeCastlingRights (int square)
void removeCastlingRights (Side side)
virtual QString vFenIncludeString (FenNotation notation) const
virtual void vInitialize ()
virtual bool vIsLegalMove (const Move &move)
Protected Member Functions inherited from Chess::Board
void addToReserve (const Piece &piece, int count=1)
int arraySize () const
bool canMove ()
Square chessSquare (const QString &str) const
Square chessSquare (int index) const
void generateDropMoves (QVarLengthArray< Move > &moves, int pieceType) const
void generateHoppingMoves (int sourceSquare, const QVarLengthArray< int > &offsets, QVarLengthArray< Move > &moves) const
void generateMoves (QVarLengthArray< Move > &moves, int pieceType=Piece::NoPiece) const
void generateSlidingMoves (int sourceSquare, const QVarLengthArray< int > &offsets, QVarLengthArray< Move > &moves) const
const MovelastMove () const
virtual int maxPieceSymbolLength () const
bool moveExists (const Move &move) const
Piece pieceAt (int square) const
bool pieceHasMovement (int pieceType, unsigned movement) const
void removeFromReserve (const Piece &piece)
virtual int reserveType (int pieceType) const
void setPieceType (int type, const QString &name, const QString &symbol, unsigned movement=0, const QString &gsymbol=QString())
void setSquare (int square, Piece piece)
int squareIndex (const QString &str) const
int squareIndex (const Square &square) const
QString squareString (const Square &square) const
QString squareString (int index) const
void xorKey (quint64 key)

Additional Inherited Members

Public Types inherited from Chess::WesternBoard
enum  WesternPieceType {
  Pawn = 1 , Knight , Bishop , Rook ,
  Queen , King
}
Public Types inherited from Chess::Board
enum  CoordinateSystem { NormalCoordinates , InvertedCoordinates }
enum  FenNotation { XFen , ShredderFen }
enum  MoveNotation { StandardAlgebraic , LongAlgebraic }
Protected Attributes inherited from Chess::WesternBoard
QVarLengthArray< PawnStep, 8 > m_pawnSteps
Static Protected Attributes inherited from Chess::WesternBoard
static const unsigned BishopMovement = 4
static const unsigned KnightMovement = 2
static const unsigned RookMovement = 8

Detailed Description

A board for S-Chess (a.k.a. Seirawan Chess).

S-Chess is a variant of standard chess which adds two piece types and is played on a regular 8x8 board.

The variant was introduced by Bruce Harper and Yasser Seirawan (USA, 2007) using the piece types of Capablanca chess under different names.

The additional pieces are called Elephant (moves like Rook + Knight), and Hawk (Bishop + Knight). These pieces are kept in reserve at first. They may enter the board on any square of the own base rank immediately after this square has been vacated for the first time. Squares that have been vacant before can not be used for entry, nor squares where captures removed the original pieces. Only one piece may enter per move. There is no obligation to use the reserve pieces.

Note
Rules: http://en.wikipedia.org/wiki/Seirawan_chess

Member Enumeration Documentation

◆ SeirawanPieceType

Special piece types for Seirawan variants.

Enumerator
Hawk 

Hawk = Princess (knight + bishop).

Elephant 

Elephant = Empress (knight + rook).

Constructor & Destructor Documentation

◆ SeirawanBoard()

Chess::SeirawanBoard::SeirawanBoard ( )

Creates a new SeirawanBoard object.

Member Function Documentation

◆ addPromotions()

void Chess::SeirawanBoard::addPromotions ( int sourceSquare,
int targetSquare,
QVarLengthArray< Move > & moves ) const
protectedvirtual

Adds pawn promotions to a move list.

This function is called when a pawn can promote by moving from sourceSquare to targetSquare. This function generates all the possible promotions and adds them to moves.

Reimplemented from Chess::WesternBoard.

◆ copy()

Board * Chess::SeirawanBoard::copy ( ) const
virtual

Creates and returns a deep copy of this board.

Implements Chess::Board.

◆ defaultFenString()

QString Chess::SeirawanBoard::defaultFenString ( ) const
virtual

Returns the variant's default starting FEN string.

Implements Chess::Board.

◆ generateMovesForPiece()

void Chess::SeirawanBoard::generateMovesForPiece ( QVarLengthArray< Move > & moves,
int pieceType,
int square ) const
protectedvirtual

Generates pseudo-legal moves for a piece of pieceType at square square.

Note
It doesn't matter if square doesn't contain a piece of pieceType, the move generator ignores it.

Reimplemented from Chess::WesternBoard.

◆ lanMoveString()

QString Chess::SeirawanBoard::lanMoveString ( const Move & move)
protectedvirtual

Converts a Move object into a string in Long Algebraic Notation (LAN)

Reimplemented from Chess::WesternBoard.

◆ moveFromLanString()

Move Chess::SeirawanBoard::moveFromLanString ( const QString & str)
protectedvirtual

Converts a string in LAN format into a Move object.

Reimplemented from Chess::WesternBoard.

◆ moveFromSanString()

Move Chess::SeirawanBoard::moveFromSanString ( const QString & str)
protectedvirtual

Converts a string in SAN format into a Move object.

Reimplemented from Chess::WesternBoard.

◆ parseCastlingRights()

bool Chess::SeirawanBoard::parseCastlingRights ( QChar c)
protectedvirtual

Parse castling rights given by character c of the FEN token. Returns true if successful.

Reimplemented from Chess::WesternBoard.

◆ reservePieceTypes()

QList< Piece > Chess::SeirawanBoard::reservePieceTypes ( ) const
protectedvirtual

Returns a list of piece types that can be in the reserve, ie. captured pieces that can be dropped on the board.

The default implementation returns an empty list.

Reimplemented from Chess::Board.

◆ sanMoveString()

QString Chess::SeirawanBoard::sanMoveString ( const Move & move)
protectedvirtual

Converts a Move object into a string in Standard Algebraic Notation (SAN).

Note
Specs: http://en.wikipedia.org/wiki/Algebraic_chess_notation

Reimplemented from Chess::WesternBoard.

◆ variant()

QString Chess::SeirawanBoard::variant ( ) const
virtual

Returns the name of the chess variant.

Implements Chess::Board.

◆ variantHasChanneling()

bool Chess::SeirawanBoard::variantHasChanneling ( Side side,
int square ) const
protectedvirtual

Returns true if a rule provides side to insert a reserve piece at a vacated source square immediately after a move. The default value is false.

See also
SeirawanBoard

Reimplemented from Chess::WesternBoard.

◆ variantHasDrops()

bool Chess::SeirawanBoard::variantHasDrops ( ) const
protectedvirtual

Returns true if the variant allows piece drops. The default value is false.

See also
CrazyhouseBoard

Reimplemented from Chess::Board.

◆ vFenString()

QString Chess::SeirawanBoard::vFenString ( FenNotation notation) const
protectedvirtual

Returns the latter part of the current position's FEN string.

This function is called by fenString(). The board state, side to move and hand pieces are handled by the base class. This function returns the rest of it, if any.

Reimplemented from Chess::WesternBoard.

◆ vMakeMove()

void Chess::SeirawanBoard::vMakeMove ( const Move & move,
BoardTransition * transition )
protectedvirtual

Makes move on the board.

This function is called by makeMove(), and should take care of everything except changing the side to move and updating the move history.

Details about piece movement, promotions, captures, drops, etc. should be stored in transition. If transition is 0 then it should be ignored.

Reimplemented from Chess::WesternBoard.

◆ vSetFenString()

bool Chess::SeirawanBoard::vSetFenString ( const QStringList & fen)
protectedvirtual

Sets the board according to a FEN string.

This function is called by setFenString(). The board state, side to move and hand pieces are handled by the base class. This function reads the rest of the string, if any.

Reimplemented from Chess::WesternBoard.

◆ vUndoMove()

void Chess::SeirawanBoard::vUndoMove ( const Move & move)
protectedvirtual

Reverses move on the board.

This function is called by undoMove() after changing the side to move to the side that made it.

Note
Unlike vMakeMove(), this function doesn't require subclasses to update the zobrist position key.

Reimplemented from Chess::WesternBoard.


The documentation for this class was generated from the following files: