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

Games with positions in which at least 3 non-pawn pieces by one side are
immured, sorted by the number of such

An immured piece is a piece that is not pinned and has no legal moves

cql(input hhdbvi.pgn)
{wtm not check
 3<=sort "Number of immured pieces"
     square Immured in [RNBQ]& ~pin
      not move legal from Immured