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

Castling and Black Moves #142

Closed
spinetrak opened this issue Oct 31, 2018 · 5 comments
Closed

Castling and Black Moves #142

spinetrak opened this issue Oct 31, 2018 · 5 comments

Comments

@spinetrak
Copy link

For whatever reason, some PGN files tolerate 0-0 (instead of O-O) for castling and say 10....Qd4 (instead of 10...Qd4) for black moves. See, for example, some of the games at https://www.hsk1830.de/pages/mannschaften/17-18/bundesligen/berichte/hsk1/Bl-Haeppchen_1718.htm - this site uses the Chessbase PGN viewer (and probably chessbase-generated PGN files, not sure).

For castling, the PGN standard is pretty clear (http://www.saremba.de/chessgml/standards/pgn/pgn-complete.htm#c8.2.3), don't know for black moves. Either way, when using such PGNs, I get parsing errors in the RPB Chessboard, and I have to fix them manually. So my question is, could the parser be a bit more fault-tolerant?

@yo35
Copy link
Owner

yo35 commented Nov 4, 2018

Hi,
As you mentioned, the PGN standard is pretty clear, on both issues:

I'm not sure it is a good idea to make the parser tolerant to this kind of errors in the PGN, as it would introduce some additional complexity to it, meaning additional maintenance effort, possibly more bugs.

The question is: how these faulty PGN files have been generated?

  • by a software (which one?): in this case, the bug is on the side of the software that has generated the PGN.
  • through manual edition: in this case, the PGN parser does its job by raising an error to warn the user that his/her input PGN text is invalid.

@spinetrak
Copy link
Author

I should have been more specific - the malformed parts are in the respective comments sections (i.e. within curly brackets).

  1. I believe these PGNs were commented using Chessbase, or at least Chessbase's own PGN viewer can deal with these PGNs (again, see the source of https://www.hsk1830.de/pages/mannschaften/17-18/bundesligen/berichte/hsk1/Bl-Haeppchen_1718.htm as an example
  2. yes, manually, in the comments sections

I understand completely that it may not be a good idea to support non-standard/non-compliant PGNs. I wanted to bring it up anyways (in particular since Chessbase is very commonly used), but pls feel free to close this Issue as Won't Fix

@yo35
Copy link
Owner

yo35 commented Jan 1, 2019

Hi,

Chessbase PGN viewer behaves in weird manner regarding these issues: from what I guess, it renders castling moves with the 0 (zero) character, but it's actually a O (capital o) that is used in the underlying PGN files.

Definitively, I prefer not to allow these syntaxes, as the PGN standard is pretty clear on what is expected to be the correct syntax on these topics. If such an ill-formed PGN file is submitted to the RPB Chessboard, an error is displayed to the user highlighting what he/she must fix. And even if there are a large number of such errors in the file, automatic text replacement can be applied to fix them all at once.

@yo35
Copy link
Owner

yo35 commented Aug 15, 2021

It appears that the FIDE handbook recommends to use character 0 (zero) for castling moves: see https://handbook.fide.com/chapter/E012018 (section C.13). This may explain why the PGN files generated by some software disobey the PGN norm on this point.

Since this convention appears in an official normalization document, and since I received several queries regarding the support of zero-encoded castling moves, I changed my mind, and I will make RPB Chessboard support that.

@yo35 yo35 reopened this Aug 15, 2021
@yo35 yo35 closed this as completed in d25e015 Aug 15, 2021
@yo35
Copy link
Owner

yo35 commented Aug 15, 2021

Fixed in version 6.2.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants