part1 (2423B)
1--- Day 23: Category Six --- 2 3The droids have finished repairing as much of the ship as they can. Their report indicates that 4this was a [1m[97mCategory 6[0m disaster - not because it was that bad, but because it destroyed the stockpile 5of Category 6 network cables as well as most of the ship's network infrastructure. 6 7You'll need to [1m[97mrebuild the network from scratch[0m. 8 9The computers on the network are standard Intcode computers that communicate by sending 10[1m[97mpackets[0m to each other. There are 50 of them in total, each running a copy of the same 11[1m[97mNetwork Interface Controller[0m (NIC) software (your puzzle input). The computers have [1m[97mnetwork 12addresses[0m 0 through 49; when each computer boots up, it will request its network address via a 13single input instruction. Be sure to give each computer a unique network address. 14 15Once a computer has received its network address, it will begin doing work and communicating over 16the network by sending and receiving [1m[97mpackets[0m. All packets contain [1m[97mtwo values[0m named X and Y. Packets 17sent to a computer are queued by the recipient and read in the order they are received. 18 19To [1m[97msend[0m a packet to another computer, the NIC will use [1m[97mthree output instructions[0m that provide the 20[1m[97mdestination address[0m of the packet followed by its X and Y values. For example, three output 21instructions that provide the values 10, 20, 30 would send a packet with X=20 and Y=30 to the 22computer with address 10. 23 24To [1m[97mreceive[0m a packet from another computer, the NIC will use an [1m[97minput instruction[0m. If the incoming 25packet queue is [1m[97mempty[0m, provide -1. Otherwise, provide the X value of the next packet; the computer 26will then use a second input instruction to receive the Y value for the same packet. Once both 27values of the packet are read in this way, the packet is removed from the queue. 28 29Note that these input and output instructions never block. Specifically, output instructions do not 30wait for the sent packet to be received - the computer might send multiple packets before receiving 31any. Similarly, input instructions do not wait for a packet to arrive - if no packet is waiting, 32input instructions should receive -1. 33 34Boot up all 50 computers and attach them to your network. [1m[97mWhat is the Y value of the first packet 35sent to address 255?[0m 36 37