between

The between filter consists of the single word between followed by two set filters enclosed in parentheses:
    between(R q)
    between(A attacks _
            a attacks q)
    between(move from A
            move to .)

Suppose x and y are two squares on and empty chessboard. We say a square z is between the squares x and y if the center of z lies on a line segment between the centers of x and y, and if z is neither x nor y. We only consider line segments that are on "basic directions": a queen on x must attack y.

For example, there are no squares between a1 and h7 . The square b2 is the only square between a1 and c3.

Suppose s and t are set filters whose corresponding sets of squares in the current position are S and T respectiviely.

Then between(s t) is the set of squares z such that z is between some square x in S and y in T.

Examples

The diagram below
D. Hlebec 2015
(found from CQL file: 8piecesinline.cql)

can be found by running 8piecesinline.cql on the sample database.

The CQL file 8piecesinline.cql matches a game with a position with a line, orthogonal or diagonal, that has 8 pieces, including the position above.

The between filter is also used in bristol-universal.cql, clearance-delayed.cql, turton.cql, wurzburg-plachutta.cql, and idealmate.cql.