Things starting to get a bit weird now...
Some nice stuff with calculating gradients and euclidian distance that was fun though.
- Iterate through grid storing all points associated with a char in a hash map.
- Perform a nested loop through each char's associated points calculating the distance between the current location (
a
) and all other locations in the vector (b
). - With the distance between locations
a
andb
move away froma
by this distance and away fromb
by the same distance. These locations are the antinodes.
- Using the same approach as Part 1, except now continue moving away from points
a
andb
until the point becomes invalid, e.g., outside of the grid.