Repository navigation
Knowledge: knowledge/openingName, the opening of a line of moves (draft-1) - #35
Merged
Merged
Conversation
…ft-1) A node that offers openingNames names the last named position along a line (fen + UCI moves) from a list it holds itself, such as Lichess's chess-openings (CC0): position, and eco, opening and ply together or not at all. It needs no import. For cjus/chessgui#755's follow-up: names offline, for any position, with none skipped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A proposed addition to the draft knowledge domain, behind a new capability switch,
openingNames:knowledge/openingName.fen, where the line starts (four to six fields; the counters are ignored), andmoves, the line's moves from it in UCI (at mostMAX_LINE_MOVES= 1,024; an empty list namesfenitself).position, the position the line ends at, asknowledge/analysesidentifies one. With it comeeco,openingandplyfor the last named position along the line: the end if a listed line ends there, or else the position before it, back tofen, as lichess.org names a game's opening. The three are there together or not at all.1. d4 Nf6 2. c4 e6 3. Nc3 d5).The node answers from a list it holds itself, such as Lichess's
chess-openings(CC0), not from imports. So it needs no import and no other switch.Why
cjus/chessgui#755 (merged as cjus/chessgui#757) names openings in Solrac's Opening Explorer from the online service's answers. Solrac learns names only for the positions it looks up, so it shows no name after a skipped position, a jump, a panel opened late, or offline. Carlos asked for the follow-up: chessdb names any line from the list, through CNP. The node walks the whole line itself, so nothing gets skipped.
The answer depends on the whole line, not only where it ends. A client applies it only to the line it asked about; comparing
positionisn't enough. The spec andcnp's module docs say so.Changed together (rule 1)
spec/knowledge.md: the capability, a "Naming openings" section withknowledge/openingNameand its examples, the -32602 row, and "Changes".cnp::knowledge:Capabilities::opening_names,MAX_LINE_MOVES,OpeningNameParams(withvalidate),OpeningNameResult(withname()),NameOpening.conformance/knowledge/opening-names.jsonl(requiresknowledge.openingNames): C70 at3... a6withply6 through4. Ba4 Nf6, the D35 transposition, the start with no name, an illegal move, a bad FEN. Its names are checked against Lichess's list as chessdb copies it.All optional: a node that doesn't offer
openingNamesis unchanged. Adding a field toCapabilitiesmeans a program that builds one by naming every field addsopening_nameswhen it next moves its pin.Next
chessdb implements it (a table keyed by position, built from the list by its explorer-index tool), then Solrac's explorer asks chessdb for the name.
Checks
cargo fmt --check,cargo clippy --workspace --all-targets -- -D warnings,cargo test,RUSTDOCFLAGS=-D\ warnings cargo doc --workspace --no-depsandcargo deny checkpass locally on this commit.🤖 Generated with Claude Code