An html version of kozirev.cql. Created by Gady Costeff and Lewis Stiller.

; This CQL file illustrates how to search for echoes in which there is some "give"; that is, it is not a perfect echo. ; The motivation for this example was to search for studies similar to the beautiful 1995 study by Kozirev in which a stalemate configuration with ; Kd1, Bd2, kd3, bd4 and Qe5 recurs rotated 90 degrees but without a pawn elsewhere on the board ; ; To do this we limit the search ; Find games in which there are two ; positions P1 and P2, such that P2 is reached by a flip or transform from P1 (except for a couple of pawns at most) ; with the same side to move, such that P1 is a stalemate, and such that ; at least 3 squares differ between P1 and P2, and such that at most 2 non-empty squares are the same ; between P1 and P2 (match :pgn heijden.pgn :output kozirev.pgn (position :stalemate :markall :piececount [KkRrQqNnBb] 4 100 ; Make sure the position is reasonably interesting :relation (:shift ; allow shifts :missingpiececount [Pp] 0 2 :newpiececount [Pp] 0 2 :samesidetomove ; same side to move in P1 and P2 :originaldifferentcount 3 100 ; P1 and P2 must differ in at least three squares :originalsamecount 0 2 ; P1 and P2 cannot coincide in more than 2 nonempty squares :flip) ; allow flips :variations ; search in variations ) )

After executing this with "> cql Kozirev.cql" there are 27 studies found in the Harold van der Heijden Database V 2015.

The output kozirev.pgn is taken as input in the next step.

An html version of kozirev2.cql

; This CQL file illustrates another way to search for echoes (shifted or flipped) in which there is some "give" ; that is, it is not a perfect echo. ; The motivation for this example was to search for ; studies similar to the beautiful 1995 study by Kozirev in which a stalemate configuration with ; Kd1, Bd2, kd3, bd4 and Qe5 ; recurs rotated 90 degrees but without a pawn elsewhere on the board ; ; To do this we limit the search to non-pawn pieces ; Find games in which there are two ; positions P1 and P2, such that P2 is reached by a flip or transform from P1 ; with the same side to move, such that P1 is a stalemate, ; at most 1 non-empty square is the same ; among the non-pawn pieces of P1 and P2 (match ; :pgn kozirev.pgn :pgn kozirev.pgn :output out.pgn (position :stalemate :markall :piececount [KkRrQqNnBb] 4 100 ; Make sure the position is reasonably interesting [KkRrQqNnBb] ; the pattern :relation (:shift ; allow shifts :pattern ; ignore pawns :samesidetomove ; same side to move in P1 and P2 :originalsamecount 0 1 ; P1 and P2 cannot coincide in more than 2 nonempty squares :flip) ; allow flips :variations ; search in variations ) )

After executing this with "> cql Kozirev2.cql" there are 23 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 5 studies are presented: