[][src]Crate shakmaty_syzygy

Probe Syzygy endgame tablebases.

Syzygy tables allow optimal play under the 50-move rule. Tables are available for positions with up to 6 (and experimentally 7) pieces.

Example

use shakmaty::Chess;
use shakmaty::fen::Fen;
use shakmaty_syzygy::{Tablebase, Wdl, Dtz, Syzygy};

let mut tables = Tablebase::new();
tables.add_directory("tables/regular")?;

let pos: Chess = "8/8/8/8/B7/N7/K2k4/8 b - - 0 1"
    .parse::<Fen>()?
    .position()?;

let wdl = tables.probe_wdl(&pos)?;
assert_eq!(wdl, Wdl::Loss);

let dtz = tables.probe_dtz(&pos)?;
assert_eq!(dtz, Dtz(-59));

Errors

See SyzygyError for possible error conditions.

Structs

Dtz

Distance to zeroing of the half-move clock.

TableType

File extension and magic header bytes of Syzygy tables.

Tablebase

A collection of tables.

Enums

Metric

Metric stored in a table: WDL or DTZ.

ProbeError

Error when probing a table.

SyzygyError

Error when probing tablebase.

Wdl

5-valued evaluation of a position in the context of the 50-move drawing rule.

Traits

Syzygy

A chess variant with Syzygy support.