aoc-2018-python

Advent of Code 2018 Solutions in Python
git clone https://git.sinitax.com/sinitax/aoc-2018-python
Log | Files | Refs | README | sfeed.txt

part1 (2894B)


      1--- Day 23: Experimental Emergency Teleportation ---
      2
      3Using your torch to search the darkness of the rocky cavern, you finally locate the man's friend: a
      4small reindeer.
      5
      6You're not sure how it got so far in this cave.  It looks sick - too sick to walk - and too heavy
      7for you to carry all the way back.  Sleighs won't be invented for another 1500 years, of course.
      8
      9The only option is experimental emergency teleportation.
     10
     11You hit the "experimental emergency teleportation" button on the device and push I accept the
     12risk on no fewer than 18 different warning messages. Immediately, the device deploys hundreds of
     13tiny nanobots which fly around the cavern, apparently assembling themselves into a very specific
     14formation. The device lists the X,Y,Z position (pos) for each nanobot as well as its signal
     15radius (r) on its tiny screen (your puzzle input).
     16
     17Each nanobot can transmit signals to any integer coordinate which is a distance away from it
     18less than or equal to its signal radius (as measured by Manhattan distance). Coordinates a distance
     19away of less than or equal to a nanobot's signal radius are said to be in range of that nanobot.
     20
     21Before you start the teleportation process, you should determine which nanobot is the
     22strongest (that is, which has the largest signal radius) and then, for that nanobot, the
     23total number of nanobots that are in range of it, including itself.
     24
     25For example, given the following nanobots:
     26
     27pos=<0,0,0>, r=4
     28pos=<1,0,0>, r=1
     29pos=<4,0,0>, r=3
     30pos=<0,2,0>, r=1
     31pos=<0,5,0>, r=3
     32pos=<0,0,3>, r=1
     33pos=<1,1,1>, r=1
     34pos=<1,1,2>, r=1
     35pos=<1,3,1>, r=1
     36
     37The strongest nanobot is the first one (position 0,0,0) because its signal radius, 4 is the largest.
     38Using that nanobot's location and signal radius, the following nanobots are in or out of range:
     39
     40
     41 - The nanobot at 0,0,0 is distance 0 away, and so it is in range.
     42
     43 - The nanobot at 1,0,0 is distance 1 away, and so it is in range.
     44
     45 - The nanobot at 4,0,0 is distance 4 away, and so it is in range.
     46
     47 - The nanobot at 0,2,0 is distance 2 away, and so it is in range.
     48
     49 - The nanobot at 0,5,0 is distance 5 away, and so it is not in range.
     50
     51 - The nanobot at 0,0,3 is distance 3 away, and so it is in range.
     52
     53 - The nanobot at 1,1,1 is distance 3 away, and so it is in range.
     54
     55 - The nanobot at 1,1,2 is distance 4 away, and so it is in range.
     56
     57 - The nanobot at 1,3,1 is distance 5 away, and so it is not in range.
     58
     59
     60In this example, in total, 7 nanobots are in range of the nanobot with the largest signal radius.
     61
     62Find the nanobot with the largest signal radius.  How many nanobots are in range of its signals?
     63
     64