Tablebases are generated by retrograde analysis, working backward from a checkmated position. Typically the database records each possible position with certain pieces remaining on the board, and the best moves with White to move and with Black to move. Thus, the tablebase acts as an oracle, always providing the optimal moves. The tablebase contains the game-theoretical value (win, loss, or draw) in each possible position, and how many moves it would take to achieve that result with perfect play. It is typically used by a computer chess engine during play, or by a human or computer that is retrospectively analysing a game that has already been played. This implies some primary tablebase lines may waste up to 1 ply.A typical interface for querying a tablebaseĪn endgame tablebase is a computerized database that contains precalculated exhaustive analysis of chess endgame positions. Losing zeroing move in in n + 1 plies and a return value +n can mean a The return value can be off by one: a return value -n can mean a Position is a draw, and a negative value if the side to move is losing.Ĭounter is zero), where a zeroing move canĪ zeroing move can be forced in n plies or Returns a positive value if the side to move is winning, 0 if the Only play according to DTZ if they can not manage on their own. However, the lines are not always the most straightforward ways to win.Įngines like Stockfish calculate themselves, checking with DTZ, but (and drawing a drawn position), because it makes progress keeping the
Minmaxing the DTZ50’’ values guarantees winning a won position probe_dtz ( board : chess.Board ) → int ¶ Note that probing corrupted table files is undefined behavior. open_tablebase ( "data/syzygy/regular" ) as tablebase. > import chess > import chess.syzygy > with chess. Mate can be forced but the position can be drawn due to the Returns 1 in case of a cursed win and -1 in case of a blessed Returns 2 if the side to move is winning, 0 if the position isĪ draw and -2 if the side to move is losing.
If board objects are not modified during probing. Probing is thread-safe when done with different board objects and Probes WDL tables for win/draw/loss information under the 50-move rule,Īssuming the position has been reached directly after a capture or probe_wdl ( board : chess.Board ) → int ¶ Returns the number of table files that were found. The relevant files are lazily opened when the tablebase is actually (e.g., WDL files like KQvKN.rtbw and DTZ files like KRBvK.rtbz)
add_directory ( directory : str, *, load_wdl : bool = True, load_dtz : bool = True ) → int ¶īy default, all available tables with the correct file names The least recently used tables are closed, If max_fds is not None, will at most use max_fds open fileĭescriptors at any given time. Manages a collection of tablebase files for probing. Tablebase ( *, max_fds: Optional = 128, VariantBoard: Type = ) ¶ This is important because 6-piece and 5-piece (let alone 7-piece) filesĪre often distributed separately, but are both required for 6-piece Material composition, as well as material compositions transitively Generally probing requires tablebase files for the specific