CQL: The Chess Query Language (version 6.1)
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
cqlspecifying that pattern.
Quick intro: mirror matesSuppose the pattern you are looking for is mirror mates, where the mated king is surrounded by empty squares:
(found from CQL file: mirrormate.cql)
You can find these by running
cql -i sample.pgn examples/mirrormate.cql
The meaning of the terms in the pattern specified in mirrormate.cql are:
btmmeans black to move;
_means empty square;
attackedbymeans attacked by.
kis the black king.
_ attackedby kis the set of empty squares adjacent to the black king.
_ attackedby k == 8means this set has 8 squares in it
flipcolormeans to repeat the search with colors interchanged.
Click on the examples tab in the sidebar for more examples.
Additional documentationAdditional contributed documentation (currently in draft form) is available at documentation . The EG discusses CQL in a number of columns, particularly by Emil Vlasàk.
DownloadsCQL may be downloaded here. Questions or comments about CQL should be directed to
costeffat the domain
VersionThe current version of CQL is CQL 6.1 (build 9.359).