The CQL file turton.cql shows how to find examples of the Turton theme. The Turton theme is a beautiful problem theme that we illustrate here with an endgame study by one of the CQL developers:
Costeff 2015, after 4...Rf4
(found from CQL file: turton.cql)

There are two thematic pieces to a Turton, which we call T and U. These must be line pieces, a , or that can slide along the same direction (so that ) are disallowed. The idea of the Turton is that white wants to double T and U so that T will support U after a move by U. In order to arrange this doubling, T passes over a critical square C and then allows U to move to C. Had U just moved initially to C, then T would move forward supported by U. The idea of the Turton is that T and U switch orientations so that U can move forward.

In the diagramed position T is the e3; U is the a2; and C is e2.

White would like to check black on e8 with T or U, supported by the other. The immediate 4.e2 fails:

after 4. Re2? (variation)
(found from CQL file: turton.cql)

due to 4...×f7, when 5.e8+ fails due to 5...f8.

Thus, White can only win by switching the orientation of the / pair. White does this in a surprising way: 4.e7! d1 reaching this position:

Costeff 2015, after 4...Qd1+
(found from CQL file: turton.cql)

Now white begins the main Turton theme with the critical move by T: 5.e1, crossing the critical square C:

after 5.Qe1
(found from CQL file: turton.cql)

Suprisingly, 5.×e1 6.×g2 wins here for white, so black tries to retreat with 5.d8 (stopping the back rank mate):

after 5....Qd8
(found from CQL file: turton.cql)

Now white moves U to the critical square C, completing the reorientation of T and U:

after 6. Re2
(found from CQL file: turton.cql)

Black tries his first defense with ×f6 but this now fails to 7.e8+ because U (the on e8 is supported by T, the e1:

after 7. Re8+ 1-0
(found from CQL file: turton.cql)

turton.cql line-by-line

The first line simply guesses values for T, U and C. T will be a piece variable that is one of :
T is a piece variable (like the piece variable in explain-likeinterference.cql) whose value is the square on which the selected piece lies. This represents the supporting piece in the Turton theme, one of . U is another piece variable, the supported piece. The ~T insures that U is a distinct piece from T, since ~T are all the squares other than the one T is on. C is the critical square, an ordinary square variable. It can range over all the empty squares initially attacked by U, that is, U.

Once candidate assignments for T, U, and C have been determined, the main work of the CQL file begins. The

tells the only to consider moves by the thematic pieces T and U.

The first constituent of the path indicates that the thematic T first moves to an empty square:


The next constituent is a filter constituent

This filter is evaluated in the position after T makes its first move (to an empty square, ). The value of from is the square from which T moved. The chained indicates that that the three squares T, C and from are in a line, with the critical square C being attacked by T. Since T is as line piece, this means that T has crossed over the square C as if moved from from to its current square.

The comment

///"T crosses critical square " C
inserts the specified comment into the PGN file as a comment to the critical move. Note that the C in the comment is replaced by the actual square's name.

The next move of the theme is

This indicates that U moves to the critical square. There can of course be any number of moves by non-thematic piece in between these first two thematic moves. Finally, U moves to a square where it is supported by T through the now-empty critical square C:


Using piece variables and ―― can allow a concise description of the key ideas of a Turton theme, including the motion of thematic pieces and the concept of a critical move that crosses a critical square.