countsquares
Thecountsquares
filter takes a range and a set filter as its arguments:
countsquares range set-filter
The filter returns true if the number of the squares in the set denoted by its set filter argument lies within its range.
For example,
countsquares 2 4 Pis true when the current position has between 2 and 4 white pawns.
The countsquares
filter is countable and counts the number of squares in its associated set. Therefore, it may be sorted. For example,
sort countsquares 1 64 attack (Q _)will sort games by the maximum number of empty squares attacked by a white Queen. This is because
attack (Q _)represents the set of empty squares attacked by a white Queen in the current position.