An html version of idealmirrormate.cql
; idealmirrormate.cql can be downloaded here.
;;This finds all ideal mirror mates: studies in which the Black King is surrounded by empty squares, is attacked once,
;;such that if the Black King were to move to one of its neighbors, it would be attacked exactly once.
;;This also finds positions in the variations, since there turn out to be Bishop mates only the variations.
(match
:pgn heijden.pgn
:output out.pgn
(position :and ;; the mating position must match each criterion below:
(
(position ; The king is surrounded by empty squares and is attacked once and is in mate
:attackcount k . 8
:attackcount A k 1
; :attackcount N k 0
:mate :btm)
;; Check that no neighbor of the black king is attacked more than once
(position :not
:attackcount k .e4 1
:attackcount A .e4 2 100
:shift
)
;; The next two clauses remove certain pathological cases let in by the above clauses. They can be removed
;; if desired, and one will find a few spurious hits
;; Check that there is no rook attacking the Black king, such that the black king would still
;; be attacked by the rook if it went to an empty square, e.g., Ra3, kd3, Qe8
(position
:not
:attackcount k .e4 1
:attackcount A .e4 1
:rayorthogonal ([QR] k .e4)
:shift
)
;; Same as above, but for diagonal moving pieces
(position
:not
:attackcount A .e4 1
:attackcount k .e4 1
:raydiagonal ([QB] k .e4)
:shift
)
)
;; Look in the variations, since otherwise you will not find any ideal mates with a bishop.
:variations
)
)