Leaderboard Positions - Part 1: 507, Part 2: 377
Hello all! In this puzzle, we need to calculate the positions of antinodes given positions of different antennas. An antinode is defined as a reflection between two antennas, specifically...
Given this:
.....
.....
.....
.a...
.....
..a..
.....
.....
.....
The antinodes are this:
.....
#....
.....
.a...
.....
..a..
.....
...#.
.....
You should just calculate the difference between the two antennas and create antinodes from those differences. Another thing is that only antennas of the same frequency should create antinodes. Each frequency consists of a letter (uppercase or lowercase) or a digit. We also need to see if the antinode iIn part 1, we need to calculate all the unique positions of every antinode. Keeping the positions in a set should do this automatically. In part 2, we now need to keep track of all antinodes from a line. So instead of doing a check for 1 in part 1, we do as many until the end of the grid. This is just as simple as trying all possible differences between -50 and 50. This highlights another edge case where now, every antenna is also now an antinode.