between function

SquareSet between(
  1. Square a,
  2. Square b
)

Gets all squares between a and b (bounds not included), or an empty set if they are not on the same rank, file or diagonal.

Implementation

SquareSet between(Square a, Square b) => ray(a, b)
    .intersect(SquareSet.full.shl(a).xor(SquareSet.full.shl(b)))
    .withoutFirst();