mirror of
https://github.com/TheRealOwenRees/chess-endgame-trainer.git
synced 2026-11-18 11:42:07 +00:00
Wire Fathom into the local tablebase backend (#30)
Add Backend.Fathom: probes positions with five or fewer pieces via the Fathom NIF, maps WDL/DTZ to the trainer structs (flipping per-move perspective), generates SAN, sorts moves best-first, and falls back to Lichess on any failure. The local directory is configured with TABLEBASE_PATH; local answers are no longer cached. Add Tablebase.normalize_wdl/1 and flip/1, plus tests for the WDL mapping, SAN, checkmate, fallback, and a cache-free end-to-end local probe.
This commit is contained in:
@@ -33,6 +33,17 @@ defmodule Chesstrainer.Endgames.TablebaseTest do
|
||||
end
|
||||
end
|
||||
|
||||
describe "normalize_wdl/1" do
|
||||
test "maps Fathom WDL atoms, treating 50-move-rule draws as draws" do
|
||||
assert Tablebase.normalize_wdl(:win) == :win
|
||||
assert Tablebase.normalize_wdl(:loss) == :loss
|
||||
assert Tablebase.normalize_wdl(:draw) == :draw
|
||||
assert Tablebase.normalize_wdl(:cursed_win) == :draw
|
||||
assert Tablebase.normalize_wdl(:blessed_loss) == :draw
|
||||
assert Tablebase.normalize_wdl(:unknown) == :unknown
|
||||
end
|
||||
end
|
||||
|
||||
describe "struct shape" do
|
||||
test "Tablebase carries only the fields the trainer reads" do
|
||||
assert %Tablebase{} |> Map.from_struct() |> Map.keys() |> Enum.sort() ==
|
||||
|
||||
Reference in New Issue
Block a user