chessops icon indicating copy to clipboard operation
chessops copied to clipboard

Support for mate eval notation starting with M

Open franciscoBSalgueiro opened this issue 2 years ago • 2 comments

It would be nice if the use of "M" followed by the number of moves to mate, was recognized as an alternative to the currently supported "#" notation. So things as [%eval M1] wouldn't be put into the text field.

franciscoBSalgueiro avatar Jan 18 '24 17:01 franciscoBSalgueiro

Do you have an example for software creating this notation, and maybe a sample PGN we can add as a test case?

niklasf avatar Jan 18 '24 20:01 niklasf

The GUI that I'm developing, En Croissant, uses the M notation. Chess.com uses M when displaying engine lines in the analysis board. CuteChess has a different way of annotating evaluations but it also uses M instead of # (example: 7. Bxd1 {+M35/33 4.3s})

Example PGN:

[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "?"]
[Black "?"]
[Result "0-1"]

1. f3 e5 2. g4 {[%eval -M1]} Qh4# 0-1

franciscoBSalgueiro avatar Jan 18 '24 23:01 franciscoBSalgueiro

Cool project!

I am hesistating ... The comments by chess.com and CuteChess are just text, so everything goes, but [%eval ...] is aimed at being unambiguously machine-readable, so introducing another syntax seems like a mistake.

niklasf avatar Jan 29 '24 21:01 niklasf

The [%eval ...] notation is also just text, it doesn't belong to the PGN standard. Since we're talking about a parser, I think it should be as lenient as possible. The output format wouldn't be changed at all.

It would be nice to eventually add support for the cutechess format too (I'm willing to make a PR for that). However, I understand if you think this is outside of the scope of this library.

franciscoBSalgueiro avatar Jan 29 '24 21:01 franciscoBSalgueiro

Ultimately yes, but at least [% ...] are somewhat formalized command sequences from https://www.enpassant.dk/chess/palview/enhancedpgn.htm. That document also briefly mentions but does not further specify an eval command. HIARCS, Lichess, python-chess and ChessBase(?) set the precedent for the command itself.

niklasf avatar Jan 29 '24 22:01 niklasf

Sorry, to clarify: I agree that the parser should be lenient, but I wouldn't preemptively add support for syntax variations that do not exist in real-world PGNs.

And that would only happen if programs like En Croissant start using M notation in [%eval ...], which is easily avoidable, even if they use it everywhere else in the user interface.

niklasf avatar Jan 29 '24 22:01 niklasf

I agree, I didn't give it much thought at the time, and I'm planning to change it to #. The intention was to keep compatibility with older versions.

However, the cutechess format is more commonly found, including in other tools like fast-chess.

franciscoBSalgueiro avatar Jan 29 '24 22:01 franciscoBSalgueiro

However, the cutechess format is more commonly found, including in other tools like fast-chess.

Mhh ... right. Would accept a patch to add support.

niklasf avatar Feb 05 '24 20:02 niklasf

Via #175.

niklasf avatar Feb 07 '24 17:02 niklasf