- const SquareDelta directionToDelta[] = {
- DELTA_E, DELTA_N, DELTA_NE, DELTA_NW, DELTA_W, DELTA_S, DELTA_SW, DELTA_SE
- };
+ const SquareDelta deltas[] = { DELTA_N, DELTA_NE, DELTA_E, DELTA_SE,
+ DELTA_S, DELTA_SW, DELTA_W, DELTA_NW };
+
+ for (int idx = 0; idx < 8; idx++)
+ {
+ Square s = orig + deltas[idx];
+
+ while (square_is_ok(s) && square_distance(s, s - deltas[idx]) == 1)
+ {
+ if (s == dest)
+ return deltas[idx];
+
+ s += deltas[idx];
+ }
+ }
+ return DELTA_NONE;
+ }
+
+ void init_between_bitboards() {