diff options
| author | Louis Burda <quent.burda@gmail.com> | 2023-04-07 17:18:18 -0400 |
|---|---|---|
| committer | Louis Burda <quent.burda@gmail.com> | 2023-04-07 17:19:39 -0400 |
| commit | 87ab487d59fa85dbe2afa55cc841b02805ae42ca (patch) | |
| tree | cd90ab715e1b5b5803674045dbafd6d51d27ac90 /src/17/part2 | |
| parent | 1bcc82c5bfbde87edd03c01ffdf9ee5934681592 (diff) | |
| download | aoc2018-python-87ab487d59fa85dbe2afa55cc841b02805ae42ca.tar.gz aoc2018-python-87ab487d59fa85dbe2afa55cc841b02805ae42ca.zip | |
Reorder days into src
Diffstat (limited to 'src/17/part2')
| -rw-r--r-- | src/17/part2 | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/src/17/part2 b/src/17/part2 new file mode 100644 index 0000000..a0801b8 --- /dev/null +++ b/src/17/part2 @@ -0,0 +1,105 @@ +--- Part Two --- + +Now for the tricky part: notifying all the other robots about the solar flare. The vacuum robot can +do this automatically if it gets into range of a robot. However, you can't see the other robots on +the camera, so you need to be thorough instead: you need to make the vacuum robot [1m[97mvisit every part +of the scaffold at least once[0m. + +The vacuum robot normally wanders randomly, but there isn't time for that today. Instead, you can +[1m[97moverride its movement logic[0m with new rules. + +Force the vacuum robot to wake up by changing the value in your ASCII program at address 0 from 1 to +[1m[97m2[0m. When you do this, you will be automatically prompted for the new movement rules that the vacuum +robot should use. The ASCII program will use input instructions to receive them, but they need to be +provided as ASCII code; end each line of logic with a single newline, ASCII code 10. + +First, you will be prompted for the [1m[97mmain movement routine[0m. The main routine may only call the +[1m[97mmovement functions[0m: A, B, or C. Supply the movement functions to use as ASCII text, separating them +with commas (,, ASCII code 44), and ending the list with a newline (ASCII code 10). For example, to +call A twice, then alternate between B and C three times, provide the string A,A,B,C,B,C,B,C and +then a newline. + +Then, you will be prompted for each [1m[97mmovement function[0m. Movement functions may use L to [1m[97mturn +left[0m, R to [1m[97mturn right[0m, or a number to [1m[97mmove forward[0m that many units. Movement functions may not call +other movement functions. Again, separate the actions with commas and end the list with a newline. +For example, to move forward 10 units, turn left, move forward 8 units, turn right, and finally move +forward 6 units, provide the string 10,L,8,R,6 and then a newline. + +Finally, you will be asked whether you want to see a [1m[97mcontinuous video feed[0m; provide either y or n +and a newline. Enabling the continuous video feed can help you see what's going on, but it also +requires a significant amount of processing power, and may even cause your Intcode computer to +overheat. + +Due to the limited amount of memory in the vacuum robot, the ASCII definitions of the main routine +and the movement functions may each contain [1m[97mat most 20 characters[0m, not counting the newline. + +For example, consider the following camera feed: + +#######...##### +#.....#...#...# +#.....#...#...# +......#...#...# +......#...###.# +......#.....#.# +^########...#.# +......#.#...#.# +......######### +........#...#.. +....#########.. +....#...#...... +....#...#...... +....#...#...... +....#####...... + +In order for the vacuum robot to [1m[97mvisit every part of the scaffold at least once[0m, one path it could +take is: + +R,8,R,8,R,4,R,4,R,8,L,6,L,2,R,4,R,4,R,8,R,8,R,8,L,6,L,2 +Without the memory limit, you could just supply this whole string to function A and have the main +routine call A once. However, you'll need to split it into smaller parts. + +One approach is: + + + - [1m[97mMain routine: A,B,C,B,A,C[0m(ASCII input: 65, 44, 66, 44, 67, 44, 66, 44, 65, 44, 67, 10) + + - [1m[97mFunction A: R,8,R,8[0m(ASCII input: 82, 44, 56, 44, 82, 44, 56, 10) + + - [1m[97mFunction B: R,4,R,4,R,8[0m(ASCII input: 82, 44, 52, 44, 82, 44, 52, 44, 82, 44, 56, 10) + + - [1m[97mFunction C: L,6,L,2[0m(ASCII input: 76, 44, 54, 44, 76, 44, 50, 10) + + +Visually, this would break the desired path into the following parts: + +A, B, C, B, A, C +R,8,R,8, R,4,R,4,R,8, L,6,L,2, R,4,R,4,R,8, R,8,R,8, L,6,L,2 + +CCCCCCA...BBBBB +C.....A...B...B +C.....A...B...B +......A...B...B +......A...CCC.B +......A.....C.B +^AAAAAAAA...C.B +......A.A...C.B +......AAAAAA#AB +........A...C.. +....BBBB#BBBB.. +....B...A...... +....B...A...... +....B...A...... +....BBBBA...... + +Of course, the scaffolding outside your ship is much more complex. + +As the vacuum robot finds other robots and notifies them of the impending solar flare, it also can't +help but leave them squeaky clean, collecting any space dust it finds. Once it finishes the +programmed set of movements, assuming it hasn't drifted off into space, the cleaning robot will +return to its docking station and report the amount of space dust it collected as a large, non-ASCII +value in a single output instruction. + +After visiting every part of the scaffold at least once, [1m[97mhow much dust does the vacuum robot report +it has collected?[0m + + |
