lastgamenumber

The lastgamenumber has as value the game number of the last game of the input PGN file that will be searched by CQL. Usually this is the same as the number of games in the PGN file, but if the -gamenumber is used on the command line, or if gamenumber is used in the CQL header to denote a range of games to search, the value of lastgamenumber might be smaller than the number of games in the file.

The purpose of lastgamenumber is to allow for special processing after the last game is evaluated, such as printing dictionaries. (Unfortunately, in practice it is cumbersome in CQL to do this sort of thing; we suggest contacting support for assistance if you need to).

lastgamenumber reads the input game file and uses various heuristics to try and guess the last game number of the file; these might always be accurate. This filter is experimental, but if it fails on a particular pgn file, please let us know.

example

  cql(input hhdbvi.pgn)
  initial
  if gamenumber==lastgamenumber
   message lastgamenumber
will output 93839 when this game number is reached, which is the number of games in version 6 of the Heijden database.

However, if this CQL file were invoked with

cql -gamenumber 1 10 filename.cql
then 10 would be output.