ray function
Gets all squares of the rank, file or diagonal with the two squares
a and b, or an empty set if they are not aligned.
Implementation
SquareSet ray(Square a, Square b) {
final other = SquareSet.fromSquare(b);
if (_rankRange[a].isIntersected(other)) {
return _rankRange[a].withSquare(a);
}
if (_antiDiagRange[a].isIntersected(other)) {
return _antiDiagRange[a].withSquare(a);
}
if (_diagRange[a].isIntersected(other)) {
return _diagRange[a].withSquare(a);
}
if (_fileRange[a].isIntersected(other)) {
return _fileRange[a].withSquare(a);
}
return SquareSet.empty;
}