if
Theif
filter has one of two forms:
if condition then then if condition then then else else
Each of condition, then and else is a filter. For example,
if R>2 then check if A attacks k then mate else Q
The meaning of the if
filter in a position is as follows:
- If condition matches the position then then is evaluated in the position.
- If condition does not match however and else is present, then else is evaluated in the position
when an if filter matches a position
Anif
filter matches a position if one of the following is true:
- condition and then both match the position
- condition does not match the position and there is no else
- condition does not match the position and else matches the position
Note that point 2 above might be suprising: an if
filter without an else
matches a position if the condition does not match:
if check then R>2will match the current position if either
- The current position is not a check, or
- The current position is a check and there are at least three white rooks in the position
The value associated with an if filter
Anif
filter has an associated value if
- it has both then and else
- it matches the position
- Its then and else are both numeric filters, both position filters, or both set filters.
if
filter matches a position, its value is the value of its then or its else , depending on whether its condition matched or failed to match the position.
Examples
Theif
filter is used in idealmate.cql, modelmate.cql, persistent.cql, puremate.cql.