Cute Chess  0.1
Public Types | Static Public Member Functions | List of all members
SyzygyTablebase Class Reference

A wrapper for probing Syzygy endgame tablebases. More...

#include <syzygytablebase.h>

Public Types

enum  CastlingFlag {
  NoCastling = 0x0, WhiteKingSide = 0x8, WhiteQueenSide = 0x4, BlackKingSide = 0x2,
  BlackQueenSide = 0x1
}
 
typedef QList< QPair< Chess::Square, Chess::Piece > > PieceList
 

Static Public Member Functions

static bool initialize (const QString &paths)
 
static Chess::Result result (const Chess::Side &side, const Chess::Square &enpassantSq, Castling castling, int rule50, const PieceList &pieces, unsigned int *dtz=nullptr)
 
static void setNoRule50 ()
 
static void setPieces (int pieces)
 
static bool tbAvailable (int pieces)
 

Detailed Description

A wrapper for probing Syzygy endgame tablebases.

Syzygy tablebases are heavily compressed tables that contain the expected result and "distance to zero" information for positions where only 2-6 pieces are left on the board. The tablebases can be used to adjudicate games or to provide perfect play in endgame positions. The Syzygy tablebases take the 50-move-rule into account. Syzygy tablebases can only be used in standard chess and Fischer Random chess.

Member Typedef Documentation

Synonym for QList< QPair<Chess::Square, Chess::Piece> >.

Member Enumeration Documentation

Castling rights.

Enumerator
NoCastling 

No castling rights.

WhiteKingSide 

White can castle on king's side.

WhiteQueenSide 

White can castle on queen's side.

BlackKingSide 

Black can castle on king's side.

BlackQueenSide 

Black can castle on queen's side.

Member Function Documentation

bool SyzygyTablebase::initialize ( const QString paths)
static

Initializes the tablebases.

Returns true if successful; otherwise returns false.

The tablebases should be located in the directories listed in paths.

Chess::Result SyzygyTablebase::result ( const Chess::Side side,
const Chess::Square enpassantSq,
Castling  castling,
int  rule50,
const PieceList pieces,
unsigned int *  dtz = nullptr 
)
static

Returns the expected game result for the positions specified by side, enpassantSq, castling and pieces.

If the position is a win for either player, dtz is set to the distance to zero, ie. the number of plies it takes to force a non-reversible move or mate.

If the position isn't found in the tablebases, a null result is returned.

See also
Chess::Board::tablebaseResult()
void SyzygyTablebase::setNoRule50 ( )
static

Disable the 50 move rule from consideration.

void SyzygyTablebase::setPieces ( int  pieces)
static

Set the maximum number of pieces to be used for tablebase adjudication. Default is no limit.

bool SyzygyTablebase::tbAvailable ( int  pieces)
static

Returns true if complete tablebases for pieces pieces are available; otherwise returns false.


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