From 5af2ab5c39cd428656729d64e0c40779f8d78bde Mon Sep 17 00:00:00 2001 From: Parnic Date: Wed, 11 Dec 2024 08:40:14 -0600 Subject: [PATCH] Tiny cleanups --- src/08.cs | 8 ++------ src/09.cs | 4 ++-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/08.cs b/src/08.cs index cb3ccab..4cf9e0f 100644 --- a/src/08.cs +++ b/src/08.cs @@ -71,18 +71,14 @@ internal class Day08 : Day foreach (var other in others) { var between = loc - other; - var a1 = loc + between; - var a2 = other - between; - while (a1.IsWithinRange(0, 0, dimensions.x - 1, dimensions.y - 1)) + for (var a1 = loc + between; a1.IsWithinRange(0, 0, dimensions.x - 1, dimensions.y - 1); a1 += between) { antinodes.Add(a1); - a1 += between; } - while (a2.IsWithinRange(0, 0, dimensions.x - 1, dimensions.y - 1)) + for (var a2 = other - between; a2.IsWithinRange(0, 0, dimensions.x - 1, dimensions.y - 1); a2 -= between) { antinodes.Add(a2); - a2 -= between; } } } diff --git a/src/09.cs b/src/09.cs index 19d74e1..a01bb8c 100644 --- a/src/09.cs +++ b/src/09.cs @@ -86,7 +86,7 @@ internal class Day09 : Day } } - return $"<+white>{checksum}"; + return $"Compacted blocks checksum: <+white>{checksum}"; } internal override string Part2() @@ -117,6 +117,6 @@ internal class Day09 : Day } } - return $"<+white>{checksum}"; + return $"Whole-file defrag checksum: <+white>{checksum}"; } }