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 [1m[97mX and Y position[0m to which the drone should be 13deployed. Negative numbers are invalid and will confuse the drone; all numbers should be 14[1m[97mzero or positive[0m. 15 16Then, the program will output whether the drone is [1m[97mstationary[0m (0) or [1m[97mbeing pulled by something[0m (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 [1m[97mget a good picture[0m 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 [1m[97mnumber of points affected by the tractor beam[0m in the 10x10 area closest to the 37emitter is [1m[97m27[0m. 38 39However, you'll need to scan a larger area to [1m[97munderstand the shape[0m of the beam. [1m[97mHow many points are 40affected by the tractor beam in the 50x50 area closest to the emitter?[0m (For each of X and Y, this 41will be 0 through 49.) 42 43