aoc-2021-rust

Advent of Code 2021 Solutions in Rust
git clone https://git.sinitax.com/sinitax/aoc-2021-rust
Log | Files | Refs | README | sfeed.txt

part2 (989B)


      1--- Part Two ---
      2
      3Unfortunately, considering only horizontal and vertical lines doesn't give you the full picture; you
      4need to also consider diagonal lines.
      5
      6Because of the limits of the hydrothermal vent mapping system, the lines in your list will only ever
      7be horizontal, vertical, or a diagonal line at exactly 45 degrees. In other words:
      8
      9
     10 - An entry like 1,1 -> 3,3 covers points 1,1, 2,2, and 3,3.
     11
     12 - An entry like 9,7 -> 7,9 covers points 9,7, 8,8, and 7,9.
     13
     14
     15Considering all lines from the above example would now produce the following diagram:
     16
     171.1....11.
     18.111...2..
     19..2.1.111.
     20...1.2.2..
     21.112313211
     22...1.2....
     23..1...1...
     24.1.....1..
     251.......1.
     26222111....
     27
     28You still need to determine the number of points where at least two lines overlap. In the above
     29example, this is still anywhere in the diagram with a 2 or larger - now a total of 12 points.
     30
     31Consider all of the lines. At how many points do at least two lines overlap?
     32
     33