Skip to content

Commit 68ff0ec

Browse files
noobpwnftwclaude
andcommitted
Add chess.chesstb: pure-Python prober for chesstb endgame tablebases
chesstb (https://github.com/noobpwnftw/chesstb) ships three table types per material: 50-move-rule-aware WDL (with cursed/blessed classes), DTC (distance-to-conversion), and a DTM50 pack that answers both the unbounded DTM and the exact 50MR DTM at any halfmove clock. This adds chess/chesstb.py, a faithful pure-Python re-implementation of the reference C++ prober (no native extension; depends only on the standard library's lzma plus a small bundled LZ4-block decoder). It covers the position index (symmetry canonicalization, king/pawn slice managers, binomial piece-group ranking, index-permutation layout), all three decoders, and the probe orchestration (dropped-frame one-ply-minimax reconstruction for shrunk files, the en-passant overlay, and DTM50 halfmove-clock layer selection). API mirrors chess.syzygy: open_tablebase(); probe_wdl/probe_dtz/probe_dtm return signed values; probe_dtm50 returns (wdl, plies); get_* are non-raising. Validated bit-for-bit against the reference C++ prober across all 145 shipped <=5-man materials and every halfmove-clock layer. A small fixture set (data/chesstb) drives ChesstbTestCase. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 8330cfd commit 68ff0ec

25 files changed

Lines changed: 2107 additions & 0 deletions

chess/chesstb.py

Lines changed: 2010 additions & 0 deletions
Large diffs are not rendered by default.

data/chesstb/dtc/KBK.lzdtc

72 Bytes
Binary file not shown.

data/chesstb/dtc/KBNK.lzdtc

243 KB
Binary file not shown.

data/chesstb/dtc/KNK.lzdtc

72 Bytes
Binary file not shown.

data/chesstb/dtc/KPK.lzdtc

2.51 KB
Binary file not shown.

data/chesstb/dtc/KQK.lzdtc

3.45 KB
Binary file not shown.

data/chesstb/dtc/KRK.lzdtc

4.45 KB
Binary file not shown.

data/chesstb/dtc/KRKR.lzdtc

13.6 KB
Binary file not shown.

data/chesstb/dtm50/KBK.lzdtm50

72 Bytes
Binary file not shown.

data/chesstb/dtm50/KBNK.lzdtm50

338 KB
Binary file not shown.

0 commit comments

Comments
 (0)