Skip to content

any word graph, chosen by config name#94

Merged
andy-k merged 2 commits into
mainfrom
any-word-graph-chosen-by-config-name
Jul 14, 2026
Merged

any word graph, chosen by config name#94
andy-k merged 2 commits into
mainfrom
any-word-graph-chosen-by-config-name

Conversation

@andy-k

@andy-k andy-k commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Summary

the endgame CLI used to pick its word graph from a small hardcoded table that mapped a lexicon name to a .kwg path, so solving a position with any word list outside that table meant recompiling the binary. this splits the two concerns apart: the argument now names only the alphabet, board layout, and tile set (english, catalan, dutch, french, german, norwegian, polish, slovene, spanish, or swedish) and never a specific word list, while a new argument takes a path to any .kwg built for that config and loads it straight from disk. the accompanying lab/endgame.txt documentation is updated to describe choosing any word graph by config name.

Changes

  • now selects only the alphabet, board layout, and tile set; a new argument loads any .kwg from disk
  • game_config_for_name replaces the old lexicon table for the CLI path
  • solve_question and the CLI now delegate to a shared solve_position(game_config, kwg, ...), a pure extraction of the word-prune-and-solve logic
  • score-diff moves to the 5th argument, following the config/kwg-file/fen/rack/score-diff order and hyphenated naming, with a usage line spelling out its sign (ahead, negative if behind)
  • update lab/endgame.txt to document choosing any word graph by config name

Correctness

solve_question (the hardcoded demo's own path) is unchanged and still reads its own two lexicon kwg files by name; extracting solve_position carries no behavior change.

andy-k added 2 commits July 12, 2026 05:12
The CLI's <lexicon> argument picked from a small hardcoded table of
lexicon-name-to-kwg-path pairs, so solving a position with any word
list outside that table meant recompiling the binary. Split the two
concerns apart: <config> now names only the alphabet, board layout,
and tile set (english, catalan, dutch, french, german, norwegian,
polish, slovene, spanish, or swedish) -- never a specific word list --
and a new <kwg-file> argument takes a path to any .kwg built for that
config, loaded straight from disk.

game_config_for_name replaces the old lexicon table for this purpose;
solve_question (the hardcoded demo's own path, unchanged, still reads
its own two lexicon kwg files by name) and the CLI both now delegate
the actual solve to a shared solve_position(game_config, kwg, ...), a
pure extraction of the word-prune-and-solve logic with no behavior
change. score-diff moves to the 5th argument and its usage line spells
out which way it points (ahead, negative if behind), following the
config/kwg-file/fen/rack/score-diff argument order and hyphenated
naming used throughout.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@andy-k
andy-k merged commit 2b1065b into main Jul 14, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant