This repository was archived by the owner on Mar 5, 2026. It is now read-only.
Repository navigation
Opening lookup by moves - #44
Merged
Merged
Conversation
- New lookupByMoves() function walks backward through move history - Works with any chess library via ChessGameLike interface - Compatible with chess.js, @chess-pgn/chess-pgn, and similar libraries - Returns opening and number of moves walked back - Includes comprehensive JSDoc and examples - Updates README with full documentation and examples
- Move lookupByMoves from separate file into methods/findOpening.ts - Simplify ChessGameLike interface (remove history() requirement) - Change undo() return type to 'unknown' for maximum compatibility - Update exports in src/index.ts - Update README documentation - All tests pass, example verified working
- Default maxMovesBack changed from unlimited to 50 plies - Parse FEN to calculate current ply without undoing all moves - Skip directly to ply 50 for longer games before walking backward - Prevents unnecessary search beyond typical opening theory - Still allows override via maxMovesBack option
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Some PGN files lack moves, or have less specific variation names than what is in eco.json. This new feature will find an eco.json variation based on the moves of a game. This uses a dependency injection pattern for the chess engine that is needed to navigate moves and derive FEN from position.