billforsternz / tarrasch-chess-gui

A portable, simple, desktop workbench for chess players and analysts
MIT License
95 stars 19 forks source link

Invalid PGNs are accepted #43

Open KarolS opened 1 year ago

KarolS commented 1 year ago

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:

What should happen:

The program should either:

friscodelrosario commented 1 year ago

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 commented 1 year ago

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.