flipverticalecho.cql

// Download flipverticalecho.cql
// PGN output when run on sample.pgn

/************
The same position occurs in the source and the target flipped about
the vertical axis. Output is sorted by number of pieces,
then the number of white pieces, then the number of black pieces
*************/
cql(input hhdbvi.pgn
    gamenumber 1 10000
    variations)

echo(s t){
 s<t
 sidetomove==s:sidetomove
 square all sq in .
  colortype sq == s:colortype
    makesquare (8 - file sq + 1
                rank sq)
 }
sort "Number pieces" [Aa]>=4
sort "Number white pieces" A
sort "Number black pieces" a