mirror of
https://github.com/TheRealOwenRees/chess-endgame-trainer.git
synced 2026-11-18 11:42:07 +00:00
Add admin bulk FEN importer (#156)
* change position of theme picker * Add admin bulk FEN importer Paste FENs, resolve results from the local Syzygy tablebase only, preview each line's status, and bulk insert with themes and a batch rating.
This commit is contained in:
@@ -12,6 +12,7 @@ defmodule Chesstrainer.Endgames.Tablebase do
|
||||
"""
|
||||
|
||||
alias Chesstrainer.Endgames.Tablebase
|
||||
alias Chesstrainer.Endgames.Tablebase.Backend.Fathom, as: FathomBackend
|
||||
alias Chesstrainer.FEN
|
||||
|
||||
@type result :: :win | :draw | :loss | :unknown
|
||||
@@ -67,6 +68,19 @@ defmodule Chesstrainer.Endgames.Tablebase do
|
||||
def flip(:draw), do: :draw
|
||||
def flip(_outcome), do: :unknown
|
||||
|
||||
@doc """
|
||||
Probes a FEN using only the local Syzygy tablebase and returns the result
|
||||
from the side-to-move's perspective.
|
||||
|
||||
Unlike `new/1` this never falls back to the remote backend and never reads or
|
||||
writes the cache. It is the primitive behind the admin bulk importer, so an
|
||||
imported result always comes from our own tablebases.
|
||||
"""
|
||||
@spec probe_local_result(String.t()) ::
|
||||
{:ok, result()}
|
||||
| {:error, :not_configured | :illegal | :terminal | :unsupported}
|
||||
def probe_local_result(fen), do: FathomBackend.probe_result_local(fen)
|
||||
|
||||
@spec new(String.t()) ::
|
||||
{:ok, t()}
|
||||
| {:cooldown, non_neg_integer()}
|
||||
|
||||
Reference in New Issue
Block a user