#chess #tablebase #endgame #retrograde

bin+lib retroboard

A chess retrograde move generator, suitable for endgame tablebase generation

14 releases

Uses new Rust 2021

0.2.9 Dec 20, 2022
0.2.8 Dec 17, 2022
0.2.6 Oct 30, 2022
0.2.4 Aug 19, 2022
0.1.3 Nov 30, 2021

#186 in Game dev

Download history 14/week @ 2022-10-14 13/week @ 2022-10-21 21/week @ 2022-10-28 6/week @ 2022-11-04 521/week @ 2022-11-11 292/week @ 2022-11-18 124/week @ 2022-11-25 450/week @ 2022-12-02 399/week @ 2022-12-09 726/week @ 2022-12-16 69/week @ 2022-12-23 19/week @ 2022-12-30 51/week @ 2023-01-06 42/week @ 2023-01-13 18/week @ 2023-01-20

132 downloads per month

AGPL-3.0+

79KB
1.5K SLoC

rs-Retroboard

crates.io docs.rs

A chess retrograde move generator. Rust port of Retroboard. Suitable for endgame tablebase generation.

Status

Strong test suite but lack of comparaison of perft result against a trusted source.

Specification

En-passant is supported, but not castling. Legal but unreachable positions are supported (mainly positions with too many checkers).

Examples of accepted unreachable positions:

  • 8/4k3/3B1B2/8/8/8/8/4K3 b - - 0 1 Impossible check
  • 8/8/R4k2/4p3/8/8/8/4K3 b - e6 0 1 Impossible en passant square. e7e5 would have been illegal because black already in check.

It aims to follow the same generation rules as used by the generation software of syzygy and Gaviota tablebase.

Performance

A very rough perft test at depth 4 on this position gives 88148797 moves in ~2s (tested on Apple M1). That is roughly 3.5x times slower than shakmaty crate, but is ought to be improved.

fen : q4N2/1p5k/3P1b2/8/6P1/4Q3/3PB1r1/2KR4 b - - 0 1, with 2PNBRQ in white pocket, 3NBRQP in black one, Q uncastling and allowing en-passant moves.

Example

use retroboard::RetroBoard;

let r = RetroBoard::new_no_pockets("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1").unwrap();
assert_eq!(r.legal_unmoves().len(), 4);

Dependencies

~2MB
~51K SLoC