CQL 5.1
; Find positions in which White does not capture a non-pawn piece with the King
; in order to lose a tempo (part of the WCCT6 theme)
; This first finds a wtm position in the variation that is the same
; as a btm position in the mainline. It then checks that this position
; arises from the mainline when the White King has the choice to capture
; or not capture a Black non-pawn piece.
; The other option for the WCCT6 theme
; is for White to avoid a capture in order to
; gain (not lose) a tempo. This can be found similarly to the "rambling rook" theme
cql(input heijden.pgn variations)
variation
wtm
{relation
mainline
(tomove mismatch)
(mismatch 0)}
silent previous(
not mainline+
{mainline
wtm
square $capture in [rbnq]
move from K to $capture
silent next(any
mainline
not K on $capture)
comment "thematic non-capture"
}
)

CQL 3.2;; This is an example of the full WCCT 6 theme.
;; It finds studies that contains a position
;; such that from that position White moves the King to an empty square rather than capturing a queen, which
;; the King instead captures on the next move.
(match
:pgn heijden.pgn
:output wcct6.pgn
(position
:wtm
:moveto .
qb2
:attackcount a ab2 0
:attackcount K ab2 1
:sequence ((position :movefrom K)
(position :attackcount a ab2 0)
)
:shift
:markall)
)

After executing this with "> cql Wcct6.cql" there are 8 studies found in the Harold van der Heijden Database 2015.NB. When you see {MATCH} in the text, it means that cql has found the position asked for.

Comments by Lewis Stiller about this theme:

- The existing CQL-3.2 wcct6.cql code looks for moves where a K declines to capture a queen instead moving to an empty square.

- The comments say that the K (or white?) instead captures the queen on the next move.

- The actual WCCT6 theme says that white avoids the capture of any non-pawn piece to "gain or lose a tempo",