mirror of
https://github.com/TheRealOwenRees/chess-endgame-trainer.git
synced 2026-11-18 11:42:07 +00:00
#5: normalise the full lichess tablebase category vocabulary (cursed-win and blessed-loss classify as draws), return {:ok, tablebase} on a cache hit, and unwrap the tablebase in game_from_fen. #6: replace the LRU cache with an LFU cache storing {key, value, frequency, last_access}, evicting the least-frequently-used entry (LRU tie-break) and halving every frequency on a weekly sweep. Persistence moves to a versioned v2 dets file, dropping the legacy backup; the cache restores synchronously at startup. Also updates stale tags enum and Play LiveView tests, and drops the tracked legacy cache backup.
42 lines
1.1 KiB
Elixir
42 lines
1.1 KiB
Elixir
defmodule Chesstrainer.Endgames.Tablebase.Move do
|
|
@moduledoc """
|
|
Moves struct for the tablebase
|
|
"""
|
|
|
|
@type result :: :win | :draw | :loss | :unknown
|
|
|
|
@type t :: %__MODULE__{
|
|
category: result,
|
|
checkmate: boolean(),
|
|
conversion: boolean(),
|
|
dtc: integer() | nil,
|
|
dtm: integer() | nil,
|
|
dtw: integer() | nil,
|
|
dtz: integer() | nil,
|
|
precise_dtz: integer() | nil,
|
|
san: String.t() | nil,
|
|
stalemate: boolean(),
|
|
uci: String.t() | nil,
|
|
variant_loss: boolean(),
|
|
variant_win: boolean(),
|
|
zeroing: boolean(),
|
|
insufficient_material: boolean()
|
|
}
|
|
|
|
defstruct category: nil,
|
|
checkmate: false,
|
|
conversion: false,
|
|
dtc: nil,
|
|
dtm: nil,
|
|
dtw: nil,
|
|
dtz: nil,
|
|
precise_dtz: nil,
|
|
san: nil,
|
|
stalemate: false,
|
|
uci: nil,
|
|
variant_loss: false,
|
|
variant_win: false,
|
|
zeroing: false,
|
|
insufficient_material: false
|
|
end
|