An html version of Zwickmuhle.cql;

Created by Gady Costeff and Lewis Stiller.

CQL 5.1

; so-called German term "Zwickmuhle" with Rook:
; A rook moves to a square, and in subsequent moves
; gives check and discovered check repeatedly

cql(input heijden.pgn)
piece $key in R
sort "theme length"
next 8 1000(
(move from $key
attacks ($key k)
move from $key
ray attack ([QB] k))+
)

CQL 3.2

;This looks for Zwickmuhle's with bishop and knight. Specifically, we ;are looking for positions where a minor piece moves to a square, ;giving check, and then later moves from the square, giving orthogonal ;check from a rook or queen, and then again from the square giving ;check. This illustrates the use of multiple positions inside a match ;list to help increase efficiency. Games not matching the first ;position will not have to run through the much more complex second ;position. (match :pgn heijden.pgn :gamenumber 1 3000 :output zwickmuhle.pgn (position :matchcount 2 1000 :flipcolor :noannotate :sequence ((position :movefrom [BN] ) (position :check :movefrom k) )) (position :flipcolor :shift :and ( (position :sequence ( (position :movefrom [BN] :moveto ?c6) (position :check :movefrom k))) (position :gappedsequence ( (position :sequence ((position :movefrom [BN]c6) (position :check :rayorthogonal ([RQ] . k) :movefrom k) ) ) (position :sequence ((position :movefrom [BN] :moveto ?c6) (position :check :movefrom k) ) ) ) ) ) ) )

After executing this with "> cql ZwickMuhle.cql" there are 9 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.

Below only 4 studies presented: