- bool reachable(Square orig, Square dest, SignedDirection dir) {
-
- SquareDelta delta = directionToDelta[dir];
- Square from = orig;
- Square to = from + delta;
- while (to != dest && square_distance(to, from) == 1 && square_is_ok(to))
- {
- from = to;
- to += delta;
- }
- return (to == dest && square_distance(from, to) == 1);
- }