An html version of wcct9.cql

CQL 5.1

; a white queen sacrifices itself on an empty square
; it does not give or prevent check

cql(input heijden.pgn result 1-0)
wtm
not check
piece $queen in Q
next(
move from $queen to .
{not check
not attacks (A $queen)
piece $attacker in a
attacks ($attacker $queen)
square 0 $pinner in [RBQ] on not $queen
ray attack ($pinner $attacker k)
}
$queen
)

CQL 3.2

; This computes the theme for the 9th World Chess Composing Tournament: 
; "In a win study, the white queen moves, without capturing, checking or refuting
; a check, to a square where she is not guarded by Whtie and where she can immediately be 
; captured by Black", (http://www.sci.fi/~stniekat/pccc/9_wcct.htm).
; It works by searching for positions where the queen moves to an empty square, and in that
; position there is no attacking piece, called $attacker, which either (a) is not pinned, or
; (b) is the only other piece on a ray with endpoints the black king and the moved white Queen.
; That is, one wants to eliminate positions where the White queen moves to a square where its only
; attackers are pinned to the black king by a piece other than that White queen. 


(match 
 :pgn heijden.pgn 
 :output wcct9.pgn
 :result 1-0
 :forany attacker [qrbnp]
 :forany Queen Q
 (position
 :markall
  :tagmatch Queen Q
  :movefrom $Queen
  :moveto .
  :nocheck
  :sequence
  ((position) 
   (position
    :attackcount $attacker $Queen 1
    :attackcount A $Queen 0 
    :or
    ((position :rayattack (A $attacker k) 0)
     (position :ray ($Queen $attacker k)))
    :nocheck)
   )
  )
 )

After executing this with "> cql Wcct9.cql" there are 431 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: