diff --git a/2023/day-11/src/part1.rs b/2023/day-11/src/part1.rs index 418e55f..b5e25cc 100644 --- a/2023/day-11/src/part1.rs +++ b/2023/day-11/src/part1.rs @@ -92,4 +92,3 @@ mod test { assert_eq!(result, "374".to_string()); } } - diff --git a/2023/day-11/src/part2.rs b/2023/day-11/src/part2.rs index e2285cf..4df48f8 100644 --- a/2023/day-11/src/part2.rs +++ b/2023/day-11/src/part2.rs @@ -32,7 +32,7 @@ pub fn part2(input: &str, modr: i64) -> String { .filter_map(|y| points.get(&(x, y).into())) .collect::>(); if column.is_empty() { - modifier += modr-1; + modifier += modr - 1; } for point in column { adjusted_points.insert(*point + I64Vec2::new(modifier, 0)); @@ -47,7 +47,7 @@ pub fn part2(input: &str, modr: i64) -> String { .filter_map(|x| adjusted_points.get(&(x, y).into())) .collect::>(); if row.is_empty() { - modifier += modr-1; + modifier += modr - 1; } for point in row { points.insert(*point + I64Vec2::new(0, modifier)); @@ -57,8 +57,8 @@ pub fn part2(input: &str, modr: i64) -> String { (points .iter() .cartesian_product(points.iter()) - .filter_map(|(a, b)| (*a != *b).then_some(*a-*b)) - .map(|a| u64::try_from(a.x.abs()+a.y.abs()).unwrap()) + .filter_map(|(a, b)| (*a != *b).then_some(*a - *b)) + .map(|a| u64::try_from(a.x.abs() + a.y.abs()).unwrap()) .sum::() / 2) .to_string() @@ -100,4 +100,3 @@ mod test { assert_eq!(result, "1030".to_string()); } } -