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

Invalid PGNs are accepted #43

Open
KarolS opened this issue Mar 22, 2023 · 2 comments
Open

Invalid PGNs are accepted #43

KarolS opened this issue Mar 22, 2023 · 2 comments

Comments

@KarolS
Copy link

KarolS commented Mar 22, 2023

Steps:

  1. create a PGN file with the following contents:
[Variant "From Position"]
[FEN "5rk1/4R2R/5r2/8/8/8/5PPP/6K1 w - - 0 1"]

1. Rg7+
  1. FileOpen and select the file

What happens:

  • The file loads, the move list contains Reg7#

What should happen:

The program should either:

  • Refuse to load the file and display an error message
  • Load the file partially up to the invalid move, and optionally display an error message
@friscodelrosario
Copy link
Contributor

friscodelrosario commented Mar 22, 2023

I created this gamescore:

  1. h4 f6 2. Rh3 Kf7 3. a4 Nh6 4. Raa3 Kg8 5. Rhg3 Kf7 6. Raf3 Kg8 7. Rxf6 Ng4 8. Rf7 Ne5 9. Rg5 Ng6 10. Rxg6 e6 11. Rh6 Be7 12. Rxh7 Nc6 13. Nc3 Ne5 14. Ne4
    Ng6 15. Nc3 Nf8 16. Rfxg7# 1-0

Then edited White's 16th as 16. Rxg7 *.

Opened the file again in Tarrasch GUI, and found that it replaced 16. Rg7 * with 16. Rfxg7+ 1-0, though the file itself was unchanged.

Weird.

There's so much malformed and illegal PGN out there. How would you suggest a PGN utility handle your use case if it was one segment of a multi-game file?

@KarolS
Copy link
Author

KarolS commented Mar 22, 2023

How would you suggest a PGN utility handle your use case if it was one segment of a multi-game file?

The same as it treats other malformed PGNs right now.

The PGN I posted would most likely be created or edited by a human by hand, and humans can introduce all sorts of errors to PGNs.

Right now, when Tarrasch encounters an obviously invalid move (something like 1. invalid#), it loads the game, but treats the invalid move and the rest of the movelist as a comment. I think this behaviour would be okay in this case, too.

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

No branches or pull requests

2 participants