:relation
keyword occurs in a position list. It takes one parameter, a relation specifier. A relation specifier is a list denoting parameters to the relation keyword. For example, the following position list,
(position :relation (:missingpiececount A 1 100))searches for games in which two positions are the same except that the later one is missing one or more white pieces.
The operation of the :relation
tag is as follows. A position list with a relation tag matches a position P1 if and only if at some later point in the current game there is a position P2 such that the relationship between P1 and P2 matches the parameters defined in the relation specifier.
The meaning of each keyword inside a relation specifier is as follows.
:pattern
keyword signifies that all piece designators that occur at the top level of the position list that encloses the current relation list define the allowable squares. Only allowable squares are considered in the comparisons. By default all squares are allowable.
:piececount
keyword in a position list: a pieced designator followed by a range. A missing piece is a piece that occurs in P1 on a square that is empty on P2. P2 matches if the number of these missing pieces lies within the range specifier. Unlike the case of the :pieccount
keyowrd, at most one :missingpiececount
specifier can occur. No shift or flip transformation specifiers in the containing position list affect the piece designator in this keyword.
The default piece designator for :missingpiececount
is U
and the default range is 0 . That is, by default there can be no missing pieces.
:piececount
keyword in a position list: a pieced designator followed by a range. A new piece is a piece that occurs in P2 on a square that is empty on P1. P2 matches if the number of these new pieces lies within the range specifier. Unlike the case of the :pieccount
keyowrd, at most one :newpiececount
specifier can occur. No shift or flip transformation specifiers in the containing position list affect the piece designator in this keyword.
The default piece designator for :newiececount
is U
and the default range is 0 . That is, by default there can be no new pieces.
(position :relation (:changesidetomove))The following position list searches for studies in which the configuration
Ke6 be7 be4 nd5occurs shifted or flipped, but in which no pieces from the original position are on the same square as the pattern:
(position Ke6 be7 be4 nd5 :shift :flip :markall :relation (:pattern :shift :flip :originalsamecount 0 :samesidetomove :variations ) )If one modified the
:originalsamecount
parameter to, say, 0 3 from its current value of 1, then the pattern in the second position would be allowed
to overlap with at most three squares of the pattern in the original position.