Tiny cleanups

This commit is contained in:
2024-12-11 08:40:14 -06:00
parent d303317ad8
commit 5af2ab5c39
2 changed files with 4 additions and 8 deletions

View File

@ -71,18 +71,14 @@ internal class Day08 : Day
foreach (var other in others) foreach (var other in others)
{ {
var between = loc - other; var between = loc - other;
var a1 = loc + between; for (var a1 = loc + between; a1.IsWithinRange(0, 0, dimensions.x - 1, dimensions.y - 1); a1 += between)
var a2 = other - between;
while (a1.IsWithinRange(0, 0, dimensions.x - 1, dimensions.y - 1))
{ {
antinodes.Add(a1); 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); antinodes.Add(a2);
a2 -= between;
} }
} }
} }

View File

@ -86,7 +86,7 @@ internal class Day09 : Day
} }
} }
return $"<+white>{checksum}"; return $"Compacted blocks checksum: <+white>{checksum}";
} }
internal override string Part2() internal override string Part2()
@ -117,6 +117,6 @@ internal class Day09 : Day
} }
} }
return $"<+white>{checksum}"; return $"Whole-file defrag checksum: <+white>{checksum}";
} }
} }