;;This file looks for all studies in which black or white castles in the main line ;; or in a variation (or both) ;; This is done simply by looking for positions such that the current move is ;; a move of a King from the e file to the c or g files (match :pgn heijden.pgn :output out.pgn (position :movefrom [Kk]e? :moveto .[c?,g?] :variations ; look also in the variations ) )