CQL version 6.0.4 release notes

  • Issues CQLI9.218-1 and CQLI9.218-2 have been fixed
  • The -alwayscomment command line option, which disables smart comments, has been documented

CQL version 6.0.3 release notes

This version is primarily a bug-fix release. We thank Robert Gamble for his assistance with this release.
  • CQLI9.218-1 In certain very unusual situations, when a comment parameter to the move filter is used when variations is set, the comment string associated to that parameter will be output as a comment when it should not be. This issue does not affect which games or positions are matched, only the comments to otherwise matching positions.
  • CQLI9.218-2 When the singlecolor parameter is used with a backward line <-- and when the arguments to the line filter include either the + or *, an error message will be printed.
  • Issues CQLI9.198-1 through CQLI9.198-10 have been fixed.
  • comment and message now accept filters that have no value as argument. If the filter has no value, then <true> or <false> is output, depending on whether the filter matches. For example
    comment ("check is: " check)
  • max and min now accept more than two arguments.
  • Some generic improvements to smart comments were made.
  • Transform filters are more efficient in many cases, and are much better at avoiding the generation of redundant transforms.
  • Transforms are now documented as supporting the count keyword. The use of range parameters to transform filters is now deprecated.
  • The notransform filter was added.
  • The currenttransform keyword in message and comment was added.
  • Modified puremate.cql, modelmate.cql, idealmate.cql to account for issue fixing CQLI9.198-7.
  • When a transform's argument is a numeric filter, then the transform filter itself is numeric with value equal to the maximum of the values of the matching transforms of its argument.
  • The transform documentation has been substantially rewritten. In addition to the introduction to transforms, there is now a more formal description. Each transform filter now has its own page.

CQL version 6.0.2 Issues

  • CQLI9.198-1 In a max filter, the comments associated to the first argument would still appear in the output PGN file even if the value associated to that first argument was smaller than the value associated to the second argument; and similarly with min. For example,
    0<=max({comment "foo" 4} {comment "bar" 5})
    would output both foo and bar as comments, even though smart comments would be expected to omit the foo comment.
  • CQLI9.198-2 passedpawns, connectedpawns, isolatedpawns, and doubledpawns all behave in ways that, although documented, are unexpected when these filters are transformed under any transformation filter other than flipcolor and fliphorizontal. For example, rotate90 passedpawns would result in neither the set of passed pawns nor the rotations of that set. This is a consequence of the definition of passedpawns, but was not clearly documented.
  • CQLI9.198-3 The o-o, o-o-o, and castle parameters to move could exhibit unexpected behavior under any transform other than flipcolor and fliphorizontal. These transforms behave as if the moving king's source and destination square were encoded as explicit square designators, which silently transformed under shift and flip. (The user more likely expects these parameters to be invariant under shift or flip transforms.)
  • **CQLI9.198-4** Consider a filter T sort E where T is a transform filter and E a numeric filter. Suppose T contains distinct basic transformations T1, T2 such that (T1E)<(T2E) in the current position. Then the value T1E rather than the correct T2E might be used for sorting purposes. This could affect the order of games that were sorted within a transformation filter, although the output set of games themselves would not be changed.
  • CQLI9.198-5 Within a compound filter F, if the value of F is numeric and used for its numeric value, and if the final filter of F did not match, then comments within F would, in certain cases, appear within the output PGN file (assuming, of course, the game as a whole matched). That is, smart comments might not delete comments associated with an unmatched numeric compound filter if that compound filter was used as a number.
  • CQLI9.198-6 Within a compound filter F, if the value of F is a position and used for its position value, and if the final filter of F did not match, then comments within F would, in certain cases, still appear within the output PGN file (assuming, of course, the game as a whole matched). That is, smart comments might not delete comments associated with an unmatched positional compound filter if that compound filter was used or its position value. For example
       {comment ("foo") true parent}:check
        or comment ("bar")
    would output both the comment foo and the comment bar to the PGN output file, when the smart comments feature should output only bar.
  • **CQLI9.198-7** Let F be a move filter that uses either the parameter legal or pseudolegal and that also uses the parameter to with argument E . Let F' be the filter that results from F by replacing E with the . filter . Let M be a move in the current position that matches the filter F' . If M is an enpassant move, then M will match the filter F .
  • CQLI9.198-8 If the keyword piece appeared followed by an identified followed by a token other than = or in, the resulting error message assumed the user intended an in, and would be confusing if the user had omitted = rather than omitting in.
  • CQLI9.198-9 An if filter could not be used for its position value even if both its then filter and its else filter were position filters. For example,
     {if check then parent else child}:parent
    would signal an error.
  • CQLI9.198-10 The documentation for max and min incorrectly stated that these filters would not match if either of their two arguments failed to match.

CQL version 6.0.2 release notes

CQL version 6.0 Issues

  • **[CQLI9.186-1]** The backward line filter can write an inaccurate comment to the output PGN file, or can signal an error, when it is used with the default comment level. To use the backward line filter, specify either silent or quiet in the CQL header.
  • [CQLI9.186-2] When the position filter is used, but the resulting position is ignored (that is, the position filter is only used to determine if its argument is nonnegative and smaller than the the number of positions in a game), the filter will always match. The workaround is not to ignore the position returned by the position filter.
  • [CQLI9.186-3] The error message signalled if the result filter has an invalid argument is not grammatical.
  • [CQLI9.186-4] The error message signalled when the filename of the file containing the CQL code is not the last argument on the command line is missing a space.
  • [CQLI9.186-5] The error message signalled when when both 'previous' and 'legal' are used with the move filter is inaccurate.
  • [CQLI9.186-6] The error message signalled when a numeric variable is used only for whether it matches, not for its value, is misleading.
  • **[CQLI9.186-7]** The elo filter does not work correctly and should not be used.
  • [CQLI9.186-8] In certain unusual cases the ray or xray filter works incorrectly. Specifically, a ray or xray filter wil be inaccurate if:
    1. the ray or xray filter has 4 or more set filter arguments;
    2. one of these arguments, say F, matches an empty square; and
    3. F is not the first, second, or last argument to the filter.
  • [CQLI9.186-9] The southwest and southeast keywords will signal an error if used as either standalone direction filters (southwest, southeast) or as parameters to ray.
  • [CQLI9.186-10] When a function is invoked without arguments, the error message output by CQL is missing a space

Release Notes for CQL version 6.0

This table below is a partial list of changes from CQL version 5.2 to CQL version 6.0. It is not complete due to the large number of changes that were made.

We thank Robert Gamble for his assistance in finding and fixing numerous bugs in version 6.0.

Note that there were also some important changes from CQL version 5.1 to CQL version 5.2. If you are still using CQL version 5.1, read the release notes for CQL 5.2 before reading these release notes. CQL 6 also runs much faster than previous versions, particularly on complex CQL files. (On an 8-core machine, we typically see speedups of a factor of between 10 and 80 compared to CQL 5.2, depending on the exactly CQL file and PGN database). CQL 6 is also substantially more expressive and compact than previous versions of CQL.


multi-threaded execution cql foo.cql CQL by default runs in multiple threads
Variable names need not start with a dollar sign checkers=A attack k A variable name can be any sequence of allowed characters and need not start with a dollar sign
Variables can hold integers, sets of squares or positions Attacks=A attacks .
x = #Attacks
y=find check
More powerful variables
Arithmetic expressions power A * 3<power a basic integer arithmetic and relational expressions
legal move checking move legal enpassant move filter supports legal and pseudolegal move computation (as well as castling and capture)
functions function forks(x){[rbnqk] attackedby x>1} user-defined functions
if if pin through a then x else y if/then/else statments
many more command line features cql -variations foo.cql arbitrary filters on the command line
many new command line options
pawn structure filters passedpawns
sort connectedpawns
pawn structure filters
run cql without a CQL file cql -i mydatabase.pgn -cql stalemate -cql btm -cql r when CQL file is missing, use cql(). as file
FEN support cql -fen 8/5kp1/p5N1/P4Pp1/6P1/PKP5/1B1r4/8 -i foo.pgn find positions in FEN notation, in CQL file or using -fen command line option
pin supportpin through A>1 Find pins
c-style comments check // the position is check
/* this line is ignored */
Anything after // on a line in a CQL file is ignored. Anything between /* and */ is ignored.
xray xray (A a k) Rays where first argument attacks second (renamed from ray attack)
persistent variables persistent NStalemates = NStalemates +1 persistent variables retain their value between games. They can be used for statistics
echo echo(s t) s&t==. simpler and more powerful replacement for old relation syntax