aoc-2019-c

Advent of Code 2019 Solutions in C
git clone https://git.sinitax.com/sinitax/aoc-2019-c
Log | Files | Refs | README | sfeed.txt

part1 (1800B)


      1--- Day 19: Tractor Beam ---
      2
      3Unsure of the state of Santa's ship, you borrowed the tractor beam technology from Triton. Time to
      4test it out.
      5
      6When you're safely away from anything else, you activate the tractor beam, but nothing happens. 
      7It's hard to tell whether it's working if there's nothing to use it on. Fortunately, your ship's
      8drone system can be configured to deploy a drone to specific coordinates and then check whether it's
      9being pulled. There's even an Intcode program (your puzzle input) that gives you access to the drone
     10system.
     11
     12The program uses two input instructions to request the X and Y position to which the drone should be
     13deployed.  Negative numbers are invalid and will confuse the drone; all numbers should be
     14zero or positive.
     15
     16Then, the program will output whether the drone is stationary (0) or being pulled by something (1).
     17For example, the coordinate X=0, Y=0 is directly in front of the tractor beam emitter, so the drone
     18control program will always report 1 at that location.
     19
     20To better understand the tractor beam, it is important to get a good picture of the beam itself. For
     21example, suppose you scan the 10x10 grid of points closest to the emitter:
     22
     23       X
     24  0->      9
     25 0#.........
     26 |.#........
     27 v..##......
     28  ...###....
     29  ....###...
     30Y .....####.
     31  ......####
     32  ......####
     33  .......###
     34 9........##
     35
     36In this example, the number of points affected by the tractor beam in the 10x10 area closest to the
     37emitter is 27.
     38
     39However, you'll need to scan a larger area to understand the shape of the beam. How many points are
     40affected by the tractor beam in the 50x50 area closest to the emitter? (For each of X and Y, this
     41will be 0 through 49.)
     42
     43