#filter has one argument, a set filter . The value of the
#-filter is the number of squares in its argument. The number of squares of a set is also called the cardinality of that set.
# filter always matches a position. If its argument is an empty set, its value is
Suppose for example that the current position is the start position of a chess game. Then
#K ≡ 1 #[Kk] ≡ 2 #P attackedby K ≡ 3
To find a position where there are multiple white queens, you could use:
In this case, however, you could just use
because a set filter that is compared to a number is automatically converted to its cardinality (that is, the set filter
is prefaced by
#filter is used in chameleon.cql, parallelpaths.cql, and queenpawnpinecho.cql.
In chameleon.cql, the line
#[Aa]==source:#[Aa]checks that the number of pieces in the current positions is the same as the number of pieces in the position named by the variable
source, using the : filter.