mirror of
https://github.com/TheRealOwenRees/chess-endgame-trainer.git
synced 2026-11-18 11:42:07 +00:00
Route tablebase lookups through a piece-count backend seam (#27)
Add a Backend behaviour, a Lichess implementation, and a Router that picks a backend by piece count: five or fewer to the local slot, six or seven to the remote slot, and eight or more short-circuited as not covered with no network call. Both slots point at Lichess for now; the local Syzygy backend replaces the local slot when it lands. Map :not_covered to the existing 'not covered by the tablebase' message.
This commit is contained in:
@@ -2,6 +2,9 @@ defmodule Chesstrainer.Endgames.Tablebase do
|
||||
@moduledoc """
|
||||
All endgame tablebase related functions.
|
||||
|
||||
Lookups are routed by piece count through `Tablebase.Router`, which picks the
|
||||
backend that can answer the position.
|
||||
|
||||
The cached value carries only what the trainer reads: `category`,
|
||||
`checkmate`, and `moves`. Cursed-win/blessed-loss are normalised to `:draw` at
|
||||
parse time, and distance fields (`dtm`/`dtc`/`dtw`) are not kept because the
|
||||
@@ -51,7 +54,7 @@ defmodule Chesstrainer.Endgames.Tablebase do
|
||||
{:ok, tablebase}
|
||||
|
||||
_ ->
|
||||
case Tablebase.Parser.from_fen(fen) do
|
||||
case Tablebase.Router.probe(fen) do
|
||||
{:error, reason} ->
|
||||
{:error, reason}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user