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

notation: remove extraneous disambiguators when decoding (L)AR #84

Merged
merged 2 commits into from
Dec 18, 2021

Conversation

sumnerevans
Copy link
Contributor

Closes #82

This PR adds support for removing unnecessary move disambiguators when decoding a move.

It also makes some refactors to use regexp, and use the same decode logic for long algebraic notation and algebraic notation.

@sumnerevans sumnerevans marked this pull request as draft December 13, 2021 00:15
@sumnerevans
Copy link
Contributor Author

Converting to draft since this causes bugs with parsing things like: bf4 from rnbqkbnr/ppp1pppp/8/3p4/3P4/8/PPP1PPPP/RNBQKBNR w KQkq - 0 2

@sumnerevans sumnerevans force-pushed the remove-extraneous-disambiguators branch from c5b7002 to 8b353c6 Compare December 13, 2021 18:12
@sumnerevans sumnerevans force-pushed the remove-extraneous-disambiguators branch from 8b353c6 to b230606 Compare December 13, 2021 18:25
@sumnerevans sumnerevans marked this pull request as ready for review December 13, 2021 18:25
@sumnerevans
Copy link
Contributor Author

@notnil I cleaned up that PR and I think it's ready for review now. I added a test for the case that I described in the last comment.

@notnil
Copy link
Owner

notnil commented Dec 18, 2021

On my computer this slows the parser down from:

BenchmarkPGN-12                       	     523	   2271381 ns/op

to

BenchmarkPGN-12                       	     312	   3853621 ns/op

likely due to regex. I think this is acceptable considering this is a bug that has come up multiple times and it makes the code easier to reason able. Thanks for creating the PR @sumnerevans .

@notnil notnil merged commit efbbef8 into notnil:master Dec 18, 2021
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.

Parser Error? (N5f6)
2 participants