mirror of
https://github.com/TheRealOwenRees/chess-endgame-trainer.git
synced 2026-11-18 03:32:06 +00:00
* Slim the cached tablebase value to the fields the trainer reads (#20) * Sample for LFU eviction instead of scanning the cache (#21) * Make cache size configurable and back up daily off-peak (#22) * Document the cache design in the glossary and an ADR (#23) * Address cache-scaling code review findings
29 lines
819 B
Elixir
29 lines
819 B
Elixir
defmodule Chesstrainer.Endgames.Tablebase.Move do
|
|
@moduledoc """
|
|
Moves struct for the tablebase
|
|
|
|
Carries only the fields the trainer reads: `category` and `dtz` for grading,
|
|
`san`/`uci` for display and matching, and `dtm`/`dtc` as small distance
|
|
hedges. Terminal detection is structural (the next position's `checkmate` or
|
|
its empty `moves`), so no per-move terminal flags are kept.
|
|
"""
|
|
|
|
@type result :: :win | :draw | :loss | :unknown
|
|
|
|
@type t :: %__MODULE__{
|
|
category: result,
|
|
dtc: integer() | nil,
|
|
dtm: integer() | nil,
|
|
dtz: integer() | nil,
|
|
san: String.t() | nil,
|
|
uci: String.t() | nil
|
|
}
|
|
|
|
defstruct category: nil,
|
|
dtc: nil,
|
|
dtm: nil,
|
|
dtz: nil,
|
|
san: nil,
|
|
uci: nil
|
|
end
|