currentmove
Any chess move represented in the PGN file of a game is determined uniquely by its tail , the position that making that move leads to.
Note that a chess move is not determined by its head , the position from which the move was made, because the same position can have multiple moves emanating from it: the primary move and any secondary moves (that is, variations).
Therefore, CQL conceptually identifies a position with the unique move leading up to that position. The move leading up to the currentposition is called the current move .
The current move is used conceptually in three ways:
- Some filters provide information about the current move, like to and from;
- the
currentmove
filter provides direct information about the current move; and - some CQL programming techniques, as illustrated in the example file lacny.cql identify the current position with the current move.
current move information filters
Certain filters query specific information about the current move, that is, the move that led to the current position. Such current move filters includefrom
,to
,enpassant
,enpassantsquare
,nullmove
, primary
, secondary
, castle
,o-o
,o-o-o
.
Each of these filters takes zero arguments:
filter name | value |
---|---|
from | Origin square(s) of moving piece(s) in current move, if any (see below for more information) |
to | Destination square of moving piece in current move (see below for more information) |
enpassant | true if current move was enpassant |
enpassantsquare | enpassant capture square of current move, if any. If the current move was not enpassant, then the empty set |
nullmove | current move is a null move |
primary | current move was a primary move, the first appearing move in the PGN file from the parent of the current position |
secondary | previous move, if any, was not a primary move |
o-o | kingside castle |
o-o-o | queenside castle |
castle | castling |
The currentmove filter
The currentmove filter can be used with the ―― filter to determine more general information about the current move. It has the syntaxcurrentmove xwhere x is any ―― filter.
The filter is true if the given ―― filter matches the current move. For example:
currentmove △――is true if the current move was by a white piece. In this case, the current position would be black to move (thus, btm would be true in the current position) but the current move would be of a white piece.
The currentmove
filter is often used to determine if the current move was not of a particular type:
not currentmove ――=△
is true if the current move (the move leading up the current position) is not a promotion.
The reason currentmove
is usually used with not
is that ordinarily, for instance, a simple ――=△
at the parent position would check if the current move was a promotion.
not currentmove ♖×♟(check)means that the current move is not a capture of a black pawn by a white rook giving check.