Cute Chess  0.1
Public Member Functions | Protected Types | Protected Member Functions | List of all members
Chess::SittuyinBoard Class Reference

A board for Sit-tu-yin (Myanmar Traditional Chess, Burmese Chess) More...

#include <sittuyinboard.h>

Inheritance diagram for Chess::SittuyinBoard:
Chess::MakrukBoard Chess::ShatranjBoard Chess::WesternBoard Chess::Board

Public Member Functions

virtual Boardcopy () const
 
virtual QString defaultFenString () const
 
 SittuyinBoard ()
 
virtual QString variant () const
 
virtual bool variantHasDrops () const
 
virtual bool variantHasOptionalPromotions () const
 
- Public Member Functions inherited from Chess::MakrukBoard
 MakrukBoard ()
 
- Public Member Functions inherited from Chess::ShatranjBoard
 ShatranjBoard ()
 
- Public Member Functions inherited from Chess::WesternBoard
virtual int height () const
 
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  SittuyinPieceType {
  Pawn = 1, Knight, Elephant = Bishop, Rook,
  General = Queen, King
}
 
- Protected Types inherited from Chess::MakrukBoard
enum  CountingRules { Makruk, BareKing }
 
enum  MakrukPieceType {
  Bia = Pawn, Ma = Knight, Khon = Bishop, Rua = Rook,
  Met = Queen, Khun = King
}
 
- Protected Types inherited from Chess::ShatranjBoard
enum  ShatranjPieceType { Ferz = Queen, Alfil = Bishop }
 
- 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 int countingLimit () const
 
virtual CountingRules countingRules () const
 
virtual void generateMovesForPiece (QVarLengthArray< Move > &moves, int pieceType, int square) const
 
virtual void generatePawnMoves (int sourceSquare, QVarLengthArray< Move > &moves) const
 
virtual bool isLegalPosition ()
 
virtual bool kingsCountAssertion (int whiteKings, int blackKings) const
 
virtual int promotionRank (int file=0) const
 
virtual QList< PiecereservePieceTypes () const
 
virtual Result result ()
 
virtual bool vIsLegalMove (const Move &move)
 
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::MakrukBoard
virtual bool inCheck (Side side, int square=0) const
 
void initHistory ()
 
virtual bool insufficientMaterial () const
 
int pieceCount (Side side=Side::NoSide, int pieceType=Piece::NoPiece) const
 
Result resultFromCounting () const
 
void setAllPieceCounters ()
 
virtual QString vFenString (FenNotation notation) const
 
virtual void vInitialize ()
 
- Protected Member Functions inherited from Chess::ShatranjBoard
virtual bool canBareOpponentKing ()
 
virtual bool hasCastling () const
 
virtual bool pawnHasDoubleStep () const
 
- Protected Member Functions inherited from Chess::WesternBoard
virtual int captureType (const Move &move) const
 
virtual int castlingFile (CastlingSide castlingSide) const
 
int enpassantSquare () const
 
bool hasCastlingRight (Side side, CastlingSide castlingSide) const
 
virtual bool hasEnPassantCaptures () const
 
virtual bool kingCanCapture () const
 
int kingSquare (Side side) const
 
virtual QString lanMoveString (const Move &move)
 
virtual Move moveFromLanString (const QString &str)
 
virtual Move moveFromSanString (const QString &str)
 
virtual bool parseCastlingRights (QChar c)
 
int pawnAmbiguity (StepType type=FreeStep) const
 
void removeCastlingRights (int square)
 
void removeCastlingRights (Side side)
 
virtual QString sanMoveString (const Move &move)
 
virtual bool variantHasChanneling (Side side, int square) const
 
virtual QString vFenIncludeString (FenNotation notation) const
 
- Protected Member Functions inherited from Chess::Board
void addToReserve (const Piece &piece, int count=1)
 
int arraySize () const
 
bool canMove ()
 
Square chessSquare (int index) const
 
Square chessSquare (const QString &str) 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 Square &square) const
 
int squareIndex (const QString &str) const
 
QString squareString (int index) const
 
QString squareString (const Square &square) 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::MakrukBoard
static const unsigned SilverGeneralMovement = 256
 
- Static Protected Attributes inherited from Chess::ShatranjBoard
static const unsigned AlfilMovement = 32
 
static const unsigned FerzMovement = 16
 
- 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 Sit-tu-yin (Myanmar Traditional Chess, Burmese Chess)

Sittuyin is the traditional variant of chess in Myanmar. It is an old game (9th century) closely related to Makruk and Chaturanga. There has been a wide variety of local or temporary rules.

Each side begins with four Pawns on the left side on their third rank and four Pawns on the right side on their fourth rank.

In the initial phase of the game the red side places their pieces behind their Pawns. After that the black side places their pieces. Rooks must be placed on the back rank. After all pieces have been placed the red side makes their first move.

Sittuyin pieces move like Makruk (Thai Chess) pieces: The movements of King, Rook, Knight, and Pawn are the same as in Makruk, Shatranj, and chess. There are no "modern" moves: no pawn double steps, and no castling. The General moves one square diagonally. The Elephant has the same move- ment but can also make a step straight forward.

If a side has no General then a Pawn can be promoted to General. This can only be done by a side's last Pawn or within the opponent's half from a square that is part of a main diagonal. Promotion counts as a move of its own. When promoting the Pawn either remains on its current square or makes a General's move. The promotion move must not give check or capture an opponent piece. Pawn promotion is optional, not oligatory: The Pawn can also make a normal move or capture.

Checkmating the opponent King wins. Stalemate is a draw. A draw can be claimed if no pawns have been moved and no captures have been made for fifty consecutive moves. A game will be drawn if it is impossible for the remaining pieces to give mate. There is no 3-fold repetition rule.

Endgames with King and Rook, or King, Elephant and General, or King, Knight and General against a lone King must be won within a defined number of moves, else the game is drawn.

Note
Rules: The Official Rules by the Myanmar Chess Federation (as described by Maung Maung Lwin).
: Set-up phase with alternating red and black piece drops.
See also
MakrukBoard
ShatranjBoard

Member Enumeration Documentation

Piece types for sittuyin variants.

Enumerator
Pawn 

Ne: Feudal Lord.

Knight 

Myin: Horse.

Elephant 

Sin: Elephant.

Rook 

Yahhta: Chariot.

General 

Sit-ke: General.

King 

Min-gyi: King.

Constructor & Destructor Documentation

Chess::SittuyinBoard::SittuyinBoard ( )

Creates a new SittuyinBoard object.

< Ne: Feudal Lord P

< Myin: Horse N

Sin: Elephant E

Yahhta: Chariot R

Sit-ke: General G

Min-gyi: King K

Member Function Documentation

void Chess::SittuyinBoard::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::ShatranjBoard.

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

Creates and returns a deep copy of this board.

Reimplemented from Chess::MakrukBoard.

int Chess::SittuyinBoard::countingLimit ( ) const
protectedvirtual

Returns maximum count of plies allowed to finish the game: Limit for Board's Honour or Pieces' Honour counting.

Reimplemented from Chess::MakrukBoard.

MakrukBoard::CountingRules Chess::SittuyinBoard::countingRules ( ) const
protectedvirtual

Returns type of counting rules to apply. Default: Makruk.

See also
OukBoard

Reimplemented from Chess::MakrukBoard.

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

Returns the variant's default starting FEN string.

Reimplemented from Chess::MakrukBoard.

void Chess::SittuyinBoard::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::MakrukBoard.

void Chess::SittuyinBoard::generatePawnMoves ( int  sourceSquare,
QVarLengthArray< Move > &  moves 
) const
protectedvirtual

Appends generated pseudo-legal pawn moves to moves

Reimplemented from Chess::MakrukBoard.

bool Chess::SittuyinBoard::isLegalPosition ( )
protectedvirtual

Returns true if the current position is a legal position. If the position isn't legal it usually means that the last move was illegal.

Reimplemented from Chess::WesternBoard.

bool Chess::SittuyinBoard::kingsCountAssertion ( int  whiteKings,
int  blackKings 
) const
protectedvirtual

Returns true if both counts of kings given by whiteKings and blackKings are correct. WesternBoard expects exactly one king per side.

See also
AntiBoard
HordeBoard

Reimplemented from Chess::WesternBoard.

int Chess::SittuyinBoard::promotionRank ( int  file = 0) const
protectedvirtual

Returns the relative rank of pawn promotions counting from 0 for the first rank. The default returns 5 for promotions on the sixth rank. The formal file parameter is unused. Override this method if the promotion rank is not uniform.

See also
SittuyinBoard

Reimplemented from Chess::MakrukBoard.

QList< Piece > Chess::SittuyinBoard::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.

Result Chess::SittuyinBoard::result ( )
protectedvirtual

Returns the result of the game, or Result::NoResult if the game is in progress.

Reimplemented from Chess::MakrukBoard.

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

Returns the name of the chess variant.

Reimplemented from Chess::MakrukBoard.

bool Chess::SittuyinBoard::variantHasDrops ( ) const
virtual

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

See also
CrazyhouseBoard

Reimplemented from Chess::Board.

bool Chess::SittuyinBoard::variantHasOptionalPromotions ( ) const
virtual

Returns true if the variant allows to skip a promotion (or a move treated as promotion) and make a normal move instead. The default value is false, i.e. mandatory promotions.

See also
GrandBoard
SeirawanBoard

Reimplemented from Chess::Board.

bool Chess::SittuyinBoard::vIsLegalMove ( const Move move)
protectedvirtual

Returns true if move is a legal move.

This function is called by isLegalMove() after making sure that there is a pseudo-legal move same as move. This function shouldn't check for the existence of move by generating moves.

The default implementation only checks if the position after move is legal.

Reimplemented from Chess::WesternBoard.

void Chess::SittuyinBoard::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::MakrukBoard.

bool Chess::SittuyinBoard::vSetFenString ( const QStringList inputFen)
protectedvirtual

This method reads FEN with full Makruk/Ouk counting support (A), standard FEN (B), and short FEN-like notation without castling rights and en passant fields (C). The latter two use Western counting and ignore Makruk counting.

A: rnsmksnr/8/pppppppp/8/8/PPPPPPPP/8/RNSKMSNR w - 0 0 1

B: rnsmksnr/8/pppppppp/8/8/PPPPPPPP/8/RNSKMSNR w - - 0 1 C: rnsmksnr/8/pppppppp/8/8/PPPPPPPP/8/RNSKMSNR w 0 1

FEN with Ouk initial move rights instead of castling rights are supported by OukBoard. Format C does not carry this information. Also see OukBoard.

Reimplemented from Chess::MakrukBoard.

void Chess::SittuyinBoard::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::MakrukBoard.


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