tarrasch-chess-gui icon indicating copy to clipboard operation
tarrasch-chess-gui copied to clipboard

Invalid PGNs are accepted

Open KarolS opened this issue 1 year ago • 2 comments

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

KarolS avatar Mar 22 '23 00:03 KarolS

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?

friscodelrosario avatar Mar 22 '23 02:03 friscodelrosario

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.

KarolS avatar Mar 22 '23 08:03 KarolS