Skip to content

Support Chess Clock Comments

Markus Liebelt edited this page Sep 8, 2019 · 6 revisions

See the ticket 122 for some background and the communication.

Resources

Current and Future Design

Current Design

The current design (of reading and evaluating moves) is the following:

  • Have read and interpreted the whole PGN directly from the grammar.
  • Only fine tune (and validate) the moves afterwards, which may lead to errors due to false moves.

So everything that may be part of the PGN is part of the grammar. If something is included in the comments, it is only evaluated, when it is %csl or %cal (stands for Color Square l and Color Arrow l (whatever l means)).

Possible Designs

Here are some options:

  • Add just more grammar rules, try to be specific (if possible), but generic for time.
  • Add just a grammar rule for commands, and parse those commands and keep them as commands with params. Do all evaluations of the commands later then in post-processing of the read PGN notation.

More Grammar

Additions are:

commentAnnotations
  = ...
  / commentAnnotationClock
commentAnnotationClock
  = bl whiteSpace? "%" cc:clockCommand whiteSpace cv:clockValue whiteSpace? br 
  { var ret = {}; ret[cc] = cv; return ret; }
clockCommand
  = "clk" { return "clk"; }
  / "egt" { return "egt"; }
  / "emt" { return "emt"; }
  / "mct" { return "mct"; }
clockValue
  = h1:digit h2:digit? ":" m1:digit m2:digit ":" s1:digit s2:digit 
  { var ret = h1; if (h2) { ret += h2 }; ret += ":" + m1 + m2 + ":" + s1 + s2; return ret; }
digit
  = d:[0-9] { return d; }

Comments on that

  • This just reads the automatic generated clock commands dome by lichess and others, and will miss clock commands included in otherwise filled comments.
  • Having clock commands as part of comments will lead to a much more complicated grammar, and it is not at all clear how to print that out in PGN then later.
  • It does not allow multiple comments (which may not needed anyway).