A CQL file consists of the word cql
, followed by a parentheses enclosed list of arguments, followed by filters.
For example, here is a CQL file to find games where Black has at least two rooks and is stalemated
cql (input hhdbvi.pgn) btm stalemate r>= 2CQL first reads the input file from the
input
parameter. Then CQL reads
each game in the file hhdbvi.pgn
. Next, CQL plays through each position
in each game. Each time CQL reads a position, CQL checks whether each of the so-called
filters is true of that position.
In this case there are three filters: btm, stalemate, and r>= 2
.
btm
will be true if the position is black to move; stalemate
will be
true if the position is stalemate; r>= 2
is true if there are at least two black rooks in the position.
If all these filters are true for a position, then CQL outputs the game (with some comments) to the output file.