Add local tablebase path config, fetch and check tasks (#31)

Read the local Syzygy directory from TABLEBASE_PATH so a dev machine and a VPS can point at their own copies. Add mix tablebase.fetch (downloads the 3/4/5 WDL+DTZ set, resumable) and mix tablebase.check (verifies it loads), plus a boot log reporting whether local tablebases are ready and the largest piece count.

Covers the codeable part of #31; installing on the VPS and setting TABLEBASE_PATH there remains a manual step.
This commit is contained in:
2026-11-03 14:26:30 +01:00
parent cb35351f8c
commit f37242ed29
7 changed files with 230 additions and 10 deletions
@@ -13,6 +13,7 @@ defmodule Chesstrainer.Endgames.Tablebase.Backend.FathomTest do
alias Chesstrainer.Endgames.Tablebase
alias Chesstrainer.Endgames.Tablebase.Backend.Fathom, as: FathomBackend
alias Chesstrainer.Endgames.Tablebase.Cache, as: TablebaseCache
alias Chesstrainer.Endgames.Tablebase.Local
alias Chesstrainer.FEN
@krk "4k3/8/8/8/8/8/8/R3K3 w - - 0 1"
@@ -36,6 +37,11 @@ defmodule Chesstrainer.Endgames.Tablebase.Backend.FathomTest do
FathomBackend.probe(@mate)
end
test "Local.check/0 reports the configured fixture set" do
assert is_binary(Local.path())
assert {:ok, 3} = Local.check()
end
test "answers through Tablebase.new without a cached entry" do
# A draw-returning fallback proves the win came from Fathom, not Lichess.
previous = Application.get_env(:chesstrainer, :tablebase_fallback)