CQL by exampleThis web page will discuss in some detail the examples listed in the sidebar under the heading Examples. They should be read in order.
Setting upUnfortunately, CQL does not have a one-click installation. In fact, installing and getting set up to use CQL is probably the trickiest part of CQL for many chess players.
- Download and install CQL
- If you on Windows and using VisualCQL, install that.
- Make sure that the file sample database is in the directory where you are going to run the examples from. Or, if you want to run the examples on, say, the HHdbVI endgame study database, make sure that the
hhdbvi.pgnfile is in that directory.
All of the examples are in the distributed versio of cql in the
examples/ subdirectory of the main distribution. You can also access the examples online. However, if you access the examples online, you will have to download the ones you use individually - the CQL program cannot read
.cql files from a URL but requires the name of a local file.
Running the examplesThe examples themselves by default use the
hhdbvi.pgn database to search for games from. This what the
input hhdbvi.pgn means at the start of the examples.
But if you do not have this database, you should use
sample.pgn instead. There are two ways to use
sample.pgnin the examples you want to run, or
- run CQL with the
cql -i sample.pgn examples/turton.cqlThis will generate a file in the current directory named
turton-out.pgnwhich you view with any PGN viewer, like ChessBase or HiArcs or the built-in chess viewer in VisualCQL.
Example explanationsThe explanations of the examples discussed:
|QQ v. qq
|mate with knight
⊢ ―― ×
□ → not btm mate
⬓ ← filter values
♖ visits 4 corners in 3 moves
∊ ✵ ◎ focus
sort up right piecepath
regular expressions in
→ → chaining
→ → chaining
▦ King's field