Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scanner: Add option flag to expand variations #127

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mikeb26
Copy link
Contributor

@mikeb26 mikeb26 commented May 26, 2023

Note this PR depends on prior PR: #125

This series of commits adds an optional ability to expand variations when utilizing Scanner to iterate over a .pgn file. This is done by introducing an optional ScannerOpts where consumers of Scanner can specify different scanning behavior, beginning with an ExpandVariations option. When ExpandVariations==true, rather than create a single Game instance when scanning over a single game in a .pgn file, Scanner will instead create 1 Game instance per variation.

This commit is part of a series to add an optional ability to expand
variations when utilizing Scanner to iterate over a .pgn file.

This commit specifically introduces ScannerOpts to enable consumers of
Scanner to specify different scanning behavior. The first intended use
is ScannerOpts.ExpandVariations. Currently Scanner will strip out any
variations that are present in a game defined within a .pgn file. This
new option (non-default) when specified will instead allow Scanner
consumers to specify that when iterating over a .pgn it should create
a new instance of a chess game for every variation
encountered. Additionally this commit refactors Scanner internals to
deal with the fact that decoding a single game may return a plural
number of Game instances rather than a singular. Code to actually
actually make this plural will be in a followup commit.

(cherry picked from commit 42e2e16)
This commit is part of a series to add an optional ability to expand
variations when utilizing Scanner to iterate over a .pgn file.

This commit specifically implements moveListSetWithComments() when
expandVariations==true. Additionally it adds a unit test to verify
Scanner behaves as expected when ExpandVariations==true.

(cherry picked from commit 666f43f)
This commit just adds a new pgn test case that ensures the combination
of a PGN with a specified starting position and the ExpandVariations
scanner option interoprate.
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