1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
pub fn chebychev_dist( x0: i64, y0: i64, x1: i64, y1: i64, ) -> i64 { (x1 - x0).abs().max((y1 - y0).abs()) } #[cfg(test)] mod tests { use super::*; #[test] fn test() { assert_eq!(chebychev_dist(-1, 3, 5, 0), 6); } }