aoc
2024.12.25
Module day15
Sections
Beacon Exclusion Zone
Module Items
Structs
Functions
In aoc::
year2022
aoc
::
year2022
Module
day15
Copy item path
Source
Expand description
§
Beacon Exclusion Zone
Structs
§
Input
Functions
§
parse
part1
The example uses y=10 but the real data uses y=2000000, so break out the logic into a separate function to enable integration testing.
part2
Similar to part one, the logic is broken out into a separate function to enable testing.
part1_
testable
A beacon cannot be located with the the radius of a sensor unless it is the closest beacon.
part2_
testable
The trick to solving this efficiently is to first
rotate
the corners of the diamond scanner shape by 45 degrees. This tranforms them into squares that make it much easier to find the missing distress beacon.