CQL: The Chess Query Language (version 6.0.4)

What is CQL?

Chess Query Language (CQL) searches for user-defined patterns in chess games and studies.

To use CQL

first, define the pattern you are looking for in the CQL language;

second, run cql specifying that pattern.

CQL will output a new file that contains all the games in the input file that match your pattern.

Quick intro: mirror mates

Suppose the pattern you are looking for is mirror mates , where the mated king is surrounded by empty squares:

You can find these by running

cql -i sample.pgn examples/mirrormate.cql

Here, sample.pgn is the file of games to search. The pattern specifying mirror mate is in the file mirrormate.cql.

The meaning of the terms in the pattern specified in mirrormate.cql are:

btm means black to move;

means black to move; mate means checkmate;

means checkmate; _ means empty square;

means empty square; attackedby means attacked by.

means attacked by. k is the black king.

is the black king. _ attackedby k is the set of empty squares adjacent to the black king.

is the set of empty squares adjacent to the black king. _ attackedby k == 8 means this set has 8 squares in it

means this set has 8 squares in it flipcolor means to repeat the search with colors interchanged.

Click on the examples tab in the sidebar for more examples.

Downloads

costeff

gmail.com

CQL may be downloaded here . Questions or comments about CQL should be directed toat the domain

Version

The current version of CQL is CQL 6.0.4.

Credits

CQL was developed by Gady Costeff and Lewis Stiller. It is copyright (c) 2003-2019 and is free. It uses SCID code by Shane Hudson to parse the PGN files.