Mercurial > hg > aoc
comparison 2017/day23/problem @ 34:049fb8e56025
Add problem statements and inputs
author | Jordi Gutiérrez Hermoso <jordigh@octave.org> |
---|---|
date | Tue, 09 Jan 2018 21:51:44 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
33:bc652fa0a645 | 34:049fb8e56025 |
---|---|
1 --- Day 23: Coprocessor Conflagration --- | |
2 | |
3 You decide to head directly to the CPU and fix the printer from there. | |
4 As you get close, you find an experimental coprocessor doing so much | |
5 work that the local programs are afraid it will halt and catch fire. | |
6 This would cause serious issues for the rest of the computer, so you | |
7 head in and see what you can do. | |
8 | |
9 The code it's running seems to be a variant of the kind you saw | |
10 recently on that tablet. The general functionality seems very similar, | |
11 but some of the instructions are different: | |
12 | |
13 set X Y sets register X to the value of Y. | |
14 | |
15 sub X Y decreases register X by the value of Y. | |
16 | |
17 mul X Y sets register X to the result of multiplying the value | |
18 contained in register X by the value of Y. | |
19 | |
20 jnz X Y jumps with an offset of the value of Y, but only if the | |
21 value of X is not zero. (An offset of 2 skips the next | |
22 instruction, an offset of -1 jumps to the previous instruction, | |
23 and so on.) | |
24 | |
25 Only the instructions listed above are used. The eight registers | |
26 here, named a through h, all start at 0. | |
27 | |
28 The coprocessor is currently set to some kind of debug mode, which | |
29 allows for testing, but prevents it from doing any meaningful work. | |
30 | |
31 If you run the program (your puzzle input), how many times is the mul | |
32 instruction invoked? | |
33 | |
34 Your puzzle answer was 3025. | |
35 | |
36 --- Part Two --- | |
37 | |
38 Now, it's time to fix the problem. | |
39 | |
40 The debug mode switch is wired directly to register a. You flip the | |
41 switch, which makes register a now start at 1 when the program is | |
42 executed. | |
43 | |
44 Immediately, the coprocessor begins to overheat. Whoever wrote this | |
45 program obviously didn't choose a very efficient implementation. | |
46 You'll need to optimize the program if it has any hope of completing | |
47 before Santa needs that printer working. | |
48 | |
49 The coprocessor's ultimate goal is to determine the final value left | |
50 in register h once the program completes. Technically, if it had | |
51 that... it wouldn't even need to run the program. | |
52 | |
53 After setting register a to 1, if the program were to run to | |
54 completion, what value would be left in register h? | |
55 | |
56 Your puzzle answer was 915. | |
57 | |
58 Both parts of this puzzle are complete! They provide two gold stars: ** |