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:
@@ -1,6 +1,7 @@
|
||||
defmodule Chesstrainer.Endgames.Tablebase.RouterTest do
|
||||
use ExUnit.Case, async: true
|
||||
|
||||
alias Chesstrainer.Endgames.Tablebase.Backend.Fathom, as: FathomBackend
|
||||
alias Chesstrainer.Endgames.Tablebase.Backend.Lichess
|
||||
alias Chesstrainer.Endgames.Tablebase.Router
|
||||
|
||||
@@ -11,7 +12,7 @@ defmodule Chesstrainer.Endgames.Tablebase.RouterTest do
|
||||
|
||||
describe "backend/1" do
|
||||
test "routes five or fewer pieces to the local slot" do
|
||||
assert Router.backend(@three) == {:ok, Lichess}
|
||||
assert Router.backend(@three) == {:ok, FathomBackend}
|
||||
end
|
||||
|
||||
test "routes six and seven pieces to the remote slot" do
|
||||
|
||||
Reference in New Issue
Block a user