Function cetkaik_yhuap_move_candidates::absolute::distance
source · Expand description
Calculates the distance between two points. The distance is defined as the larger of the difference between either the x or y coordinates. /2点間の距離(x座標の差およびy座標の差のうち小さくない方)を計算する。
Examples:
use cetkaik_core::absolute::{distance, Coord};
use cetkaik_core::absolute::Row::*;
use cetkaik_core::absolute::Column::*;
assert_eq!(2, distance(Coord(A, K), Coord(I, N)));
assert_eq!(2, distance(Coord(I, K), Coord(I, N)));
// The standard cetkaik does not care about knight's moves, but is tested for the sake of consistency.
assert_eq!(2, distance(Coord(A, K), Coord(E, N)));