Documentation
¶
Overview ¶
Package fathom is a Syzygy tablebase probe implementation.
This package wraps a fork of an original Fathom tool written in C: https://github.com/jdart1/Fathom.
Also it uses well-known external package https://github.com/notnil/chess as a public communication layer.
Methods allow to probe DTZ and WDL tables (*.rtbw and *.rtbz Syzygy tablebases).
Index ¶
Constants ¶
Variables ¶
var ErrCheckmate = errors.New("go-fathom: checkmate")
ErrCheckmate unable to dig, because the game is over: checkmate
var ErrNoTablebases = errors.New("go-fathom: no tablebase files are found")
ErrNoTablebases no tablebase files are found within specified directory
var ErrStalemate = errors.New("go-fathom: stalemate")
ErrStalemate unable to dig, because the game is over: stalemate
Functions ¶
This section is empty.
Types ¶
type Fathom ¶
type Fathom interface {
// ProbeWDL probes the win-draw-loss (WDL) table.
//
// Returns one of: [Loss], [BlessedLoss], [Draw], [CursedWin] or [Win].
// When error occurs, WDL results in [WDLUnknown].
//
// NOTES:
// - Engines should use this function during search.
ProbeWDL(chessPosition *chess.Position) (WDL, error)
// ProbeRoot probes the Distance-To-Zero (DTZ) table.
//
// The suggested move is guaranteed to preserve the WDL value.
// Possible errors: [ErrCheckmate], [ErrStalemate] (and other).
//
// NOTES:
// - Engines can use this function to probe at the root. This function should
// not be used during search.
// - DTZ tablebases can suggest unnatural moves, especially for losing
// positions. Engines may prefer to perform traditional search combined with WDL
// move filtering using the alternative results array.
// - This function is NOT thread safe. For engines this function should only
// be called once at the root per search.
ProbeRoot(chessPosition *chess.Position) (TbMove, []TbResult, error)
// ProbeRootDTZ uses the DTZ tables to rank and score all root moves.
ProbeRootDTZ(chessPosition *chess.Position, useRule50 bool) ([]TbRootMove, error)
// ProbeRootWDL uses the WDL tables to rank and score all root moves.
//
// NOTES:
// - This is a fallback for the case that some or all DTZ tables are missing.
ProbeRootWDL(chessPosition *chess.Position, useRule50 bool) ([]TbRootMove, error)
// Close frees any resources allocated by an instance.
Close()
}
func NewFathom ¶
NewFathom creates a new Fathom reader. If no tablebase files are found, then error is returned.
Possible errors: ErrNoTablebases
If you don't have tablebase files yet, follow this link (https://github.com/niklasf/shakmaty-syzygy/tree/master/tables) and explore suggested TXT. These TXT files contain URLs to tablebase files you should download.
type TbResult ¶
TbResult is a result value comprising: suggested move, the WDL value and the DTZ value.