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

Fix inconsistent next and previous pointers #21

Merged
merged 1 commit into from
Dec 22, 2023

Conversation

donkawechico
Copy link
Contributor

@donkawechico donkawechico commented Oct 20, 2023

See #20.

Overview

  • Changes History.traverse() to only set previous and next pointers if move doesn't already have pointers set.
  • Adds two unit tests that recursively checks ALL variation lines in a PGN and ensures self-consistency

This fixes (what I believe to be) a bug in traverse where a move in the main line will get its next property set to the first move of an alternate line rather than the next move in its own line.

In general, it seems the correct behavior ought to be that every move in move.variation should satisfy

move.variation[0] <--> move.variation[1] <--> move.variation[2] <--> ... <--> move.variation[n]

If one of those moves has variations branching off it, that shouldn't matter to that move's previous and next pointers.

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.

None yet

2 participants