mirror of
https://github.com/TheRealOwenRees/chess-endgame-trainer.git
synced 2026-11-18 11:42:07 +00:00
Derive disjoint material family themes from each endgame's Key (#193)
Every endgame now belongs to exactly one material family derived from its Key: pawn, rook, rook and pawn, queen, queen and pawn, minor piece, minor piece and pawn, basic mate, king and pawn, or bare king other. The bare-king families are split out because those positions teach a mating or promotion technique rather than a general material class. Family membership is objective, so a derivation pass owns links to its themes: refreshing rewrites them as derived and removes a curated link that contradicts the family, while technique themes are untouched. Re-running is idempotent. A mix task applies the mapping to the whole library. Seeds add the king technique themes for later human tagging. Closes #186
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
defmodule Mix.Tasks.Themes.DeriveMaterial do
|
||||
use Mix.Task
|
||||
|
||||
@shortdoc "Tags every endgame with its material family theme"
|
||||
|
||||
@moduledoc """
|
||||
Derives each endgame's material family from its Key and stores the result as
|
||||
a derived theme.
|
||||
|
||||
mix themes.derive_material
|
||||
|
||||
Every endgame belongs to exactly one family, so the themes partition the
|
||||
library. Re-running is idempotent: only derived links are replaced, and
|
||||
curated or community links are untouched.
|
||||
|
||||
Positions that are kings only, or that have no Key, are reported as skipped.
|
||||
"""
|
||||
|
||||
@impl Mix.Task
|
||||
def run(_args) do
|
||||
Mix.Task.run("app.start")
|
||||
|
||||
%{tagged: tagged, skipped: skipped, themes: themes} =
|
||||
Chesstrainer.Endgames.MaterialThemes.derive()
|
||||
|
||||
Mix.shell().info(
|
||||
"Material themes: #{themes} themes, #{tagged} endgames tagged, " <>
|
||||
"#{skipped} skipped (kings only or no Key)."
|
||||
)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user