Skip to content

Bug re: en passant square in TB probing #3

@jtheardw

Description

@jtheardw

Hi,
I'm another Rust chess engine dev, and I was adding Fathom/Syzygy support to my own engine by closely following Asymptote's approach (thanks so much btw will definitely credit in release). But while doing so I noticed that when converting Asymptotes board representation into the form for Fathom (in src/position.rs), there's a bug in determining the ep square when white did the double-push.

This position, contrived as it is, should show the problem: 8/8/8/8/5Pp1/2k5/7P/K7 b - f3 0 1. The correct move is a capture en passant, but if using the TB, Asymptote will choose Kc4. This issue does not appear in the mirrored equivalent of this position.

setoption name SyzygyPath value /home/jtwright/chess/tablebase/3-4-5/
info string found 5-piece Syzygy Tablebases
position fen 8/8/8/8/5Pp1/2k5/7P/K7 b - f3 0 1
go wtime 1000 btime 1000
info depth 127 seldepth 0 nodes 0 nps 0 tbhits 0 score cp 0 time 0 hashfull 0 pv 
bestmove c3c4

I believe the issue stems from the spot where you use 3 * rank + ep_file (paraphrasing) in the conversion. The ranks are 0-indexed so it should be 2 * rank + ep_file

Thanks again for having such a clear example of using the fathom library in Asymptote. It was incredibly helpful for me, so I'm hoping this is giving back in some way, even though this bug would be exceptionally rare...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions