int distance_row(unsigned from, unsigned to)
{
+ /* 4.1m per double row, plus gaps */
+ unsigned base_cost = 41 * abs(from - to);
+
+ if ((from <= 9) != (to <= 9))
+ base_cost += 25;
+ if ((from <= 17) != (to <= 17))
+ base_cost += 25;
+ if ((from <= 25) != (to <= 25))
+ base_cost += 25;
+ if ((from <= 34) != (to <= 34))
+ base_cost += 25;
+
/* don't calculate gaps here just yet, just estimate 4.1m per double row */
- return 41 * abs(from - to);
+ return base_cost;
}
int pessimistic_distance(int row_from, int switch_from, int row_to, int switch_to)