io-chess
UCI chess engine
Loading...
Searching...
No Matches
Tablebase Namespace Reference

Enumerations

enum class  WDL {
  WIN = 2 , CURSED_WIN = 1 , DRAW = 0 , BLESSED_LOSS = -1 ,
  LOSS = -2
}
 Tablebase probe result for Win-Draw-Loss. More...

Functions

bool init (const std::string &path)
 Initializes tablebases with the given path.
bool available (const Board &board)
 Checks if a position is within the tablebase piece limits.
std::optional< WDLprobeWDL (const Board &board)
 Probes the Win-Draw-Loss (WDL) table.
std::optional< std::tuple< Move, WDL, int > > probeRoot (const Board &board)
 Probes the Distance-to-Zero (DTZ) table for root moves.
int wdlToScore (WDL wdl, int mate_ply)
 Converts a WDL result to a centipawn score for search evaluation.
int maxPieces ()
 Gets the maximum number of pieces supported by the loaded tablebases.
bool isInitialized ()
 Checks if tablebases have been successfully initialized.

Variables

static bool initialized_ = false
static int maxPieces_ = 0

Enumeration Type Documentation

◆ WDL

enum class Tablebase::WDL
strong

Tablebase probe result for Win-Draw-Loss.

Enumerator
WIN 

Forced win.

CURSED_WIN 

Win, but thwarted by the 50-move rule (draw).

DRAW 

Forced draw.

BLESSED_LOSS 

Loss, but saved by the 50-move rule (draw).

LOSS 

Forced loss.

Function Documentation

◆ available()

bool Tablebase::available ( const Board & board)

Checks if a position is within the tablebase piece limits.

Parameters
boardThe chess board to check.
Returns
True if the board has <= maxPieces() pieces.
Here is the caller graph for this function:

◆ init()

bool Tablebase::init ( const std::string & path)

Initializes tablebases with the given path.

Parameters
pathPath to the Syzygy tablebase files.
Returns
True on success, false otherwise.
Here is the caller graph for this function:

◆ isInitialized()

bool Tablebase::isInitialized ( )

Checks if tablebases have been successfully initialized.

◆ maxPieces()

int Tablebase::maxPieces ( )

Gets the maximum number of pieces supported by the loaded tablebases.

◆ probeRoot()

std::optional< std::tuple< Move, WDL, int > > Tablebase::probeRoot ( const Board & board)

Probes the Distance-to-Zero (DTZ) table for root moves.

Parameters
boardThe chess board to probe.
Returns
Tuple of best move, WDL value, and DTZ value, or std::nullopt on failure.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ probeWDL()

std::optional< WDL > Tablebase::probeWDL ( const Board & board)

Probes the Win-Draw-Loss (WDL) table.

Parameters
boardThe chess board to probe.
Returns
WDL value from side-to-move's perspective, or std::nullopt on failure.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wdlToScore()

int Tablebase::wdlToScore ( WDL wdl,
int mate_ply )

Converts a WDL result to a centipawn score for search evaluation.

Parameters
wdlThe WDL result.
mate_plyDistance to mate (used to scale WIN/LOSS scores).
Returns
Centipawn score representation of the tablebase result.
Here is the caller graph for this function:

Variable Documentation

◆ initialized_

bool Tablebase::initialized_ = false
static

◆ maxPieces_

int Tablebase::maxPieces_ = 0
static