Cute Chess 0.1
Chess::NCheckBoard Class Reference

A board for N-Check Chess. More...

#include <ncheckboard.h>

Inheritance diagram for Chess::NCheckBoard:
Chess::StandardBoard Chess::WesternBoard Chess::Board Chess::FiveCheckBoard Chess::ThreeCheckBoard

Public Member Functions

int checksToWin (Side side) const
virtual Boardcopy () const
virtual QString defaultFenString () const
virtual Result result ()
virtual QString variant () const
Public Member Functions inherited from Chess::StandardBoard
 StandardBoard ()
virtual Result tablebaseResult (unsigned int *dtm=nullptr) const
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
virtual QList< PiecereservePieceTypes () const
void reset ()
bool setFenString (const QString &fen)
Side sideToMove () const
QString startingFenString () const
Side startingSide () const
void undoMove ()
virtual Side upperCaseSide () const
virtual bool variantHasDrops () const
virtual bool variantHasWallSquares () const
virtual ~Board ()

Protected Member Functions

int checkLimit () const
 NCheckBoard (int n=3)
virtual QString vFenIncludeString (FenNotation notation) const
virtual void vInitialize ()
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 void addPromotions (int sourceSquare, int targetSquare, QVarLengthArray< Move > &moves) const
virtual int captureType (const Move &move) const
virtual int castlingFile (CastlingSide castlingSide) const
int enpassantSquare () const
virtual void generateMovesForPiece (QVarLengthArray< Move > &moves, int pieceType, int square) 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
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
virtual bool pawnHasDoubleStep () 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 vFenString (FenNotation notation) const
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 Types inherited from Chess::WesternBoard
enum  CastlingSide { QueenSide , KingSide , NoCastlingSide }
enum  StepType { NoStep = 0 , FreeStep = 1 , CaptureStep = 2 }
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 N-Check Chess.

N-Check chess is a variant of standard chess with an additional rule. A player also wins when he gives check n times in a game.

Note
Rules: http://en.wikipedia.org/wiki/Three-check_chess

NCheckBoard uses Polyglot-compatible zobrist position keys, so N-Check opening books in Polyglot format could be used.

Note
Standard Chess Rules: http://www.fide.com/component/handbook/?id=124&view=article
See also
PolyglotBook

Constructor & Destructor Documentation

◆ NCheckBoard()

Chess::NCheckBoard::NCheckBoard ( int n = 3)
protected

Creates a new NCheckBoard object. Giving the n -th check wins. Defaults to Three-Check (variant: 3Check)

Member Function Documentation

◆ checkLimit()

int Chess::NCheckBoard::checkLimit ( ) const
inlineprotected

Returns total number of checks necessary to win

◆ checksToWin()

int Chess::NCheckBoard::checksToWin ( Side side) const

Returns number of checks yet needed for side to win

◆ copy()

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

Creates and returns a deep copy of this board.

Reimplemented from Chess::StandardBoard.

Reimplemented in Chess::FiveCheckBoard, and Chess::ThreeCheckBoard.

◆ defaultFenString()

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

Returns the variant's default starting FEN string.

Reimplemented from Chess::StandardBoard.

◆ result()

Result Chess::NCheckBoard::result ( )
virtual

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

Reimplemented from Chess::WesternBoard.

◆ variant()

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

Returns the name of the chess variant.

Reimplemented from Chess::StandardBoard.

◆ vFenIncludeString()

QString Chess::NCheckBoard::vFenIncludeString ( Board::FenNotation notation) const
protectedvirtual

A format to extend FEN for N-Check was suggested by H. G. Muller: The numbers of checks to win the game are given for both sides in succession of the the en passant field. They are separated by a single plus sign "+" (check symbol) without any other character in between (like 3+3). In contrast SCIDB and Lichess use two plus signs and forward counters (like +0+0) appended to the normal FEN.

Reimplemented from Chess::WesternBoard.

◆ vInitialize()

void Chess::NCheckBoard::vInitialize ( )
protectedvirtual

Initializes the variant.

This function is called by initialize(). Subclasses shouldn't generally call it by themselves.

Reimplemented from Chess::WesternBoard.

◆ vMakeMove()

void Chess::NCheckBoard::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::NCheckBoard::vSetFenString ( const QStringList & fen)
protectedvirtual

This method extracts check counters from extended FEN (like Xboard / Stockfish and SCIDB / Lichess formats) and is tolerant to standard FEN. If no counters can be extracted (e.g. from a standard FEN) the number of checks to win will be set to checkLimit. Calls StandardBoard method for FEN handling.

Reimplemented from Chess::WesternBoard.

◆ vUndoMove()

void Chess::NCheckBoard::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: