commit 275a3d01c70d70487e4307e8735106d895803cba
parent 57ccf30bbe25ea907a6c4136ceb39ad3f5fa589d
Author: Louis Burda <quent.burda@gmail.com>
Date: Fri, 7 Apr 2023 16:26:45 -0400
Use vtty colored text for all days
Diffstat:
56 files changed, 592 insertions(+), 719 deletions(-)
diff --git a/.gitmodules b/.gitmodules
@@ -13,6 +13,3 @@
[submodule "lib/liblist"]
path = lib/liblist
url = git@sinitax.com:snx/liblist
-[submodule "lib/libpq"]
- path = lib/libpq
- url = git@sinitax.com:snx/libpq
diff --git a/01/main.c b/01/main.c
@@ -10,8 +10,8 @@
void
part1(void)
{
- const char *pos, *end;
char buf[256];
+ const char *pos, *end;
int64_t fuel, ans;
pos = aoc.input;
@@ -30,8 +30,8 @@ part1(void)
void
part2(void)
{
- const char *pos, *end;
char buf[256];
+ const char *pos, *end;
int64_t fuel, ans;
pos = aoc.input;
diff --git a/01/part1 b/01/part1
@@ -2,8 +2,7 @@
Santa has become stranded at the edge of the Solar System while delivering presents to other
planets! To accurately calculate his position in space, safely align his warp drive, and return to
-Earth in time to save Christmas, he needs you to bring him measurements from [1m[33mfifty
-stars[0m.
+Earth in time to save Christmas, he needs you to bring him measurements from [1m[33mfifty stars[0m.
Collect stars by solving puzzles. Two puzzles will be made available on each day in the Advent
calendar; the second puzzle is unlocked when you complete the first. Each puzzle grants
@@ -14,16 +13,18 @@ The Elves quickly load you into a spacecraft and prepare to launch.
At the first Go / No Go poll, every Elf is Go until the Fuel Counter-Upper. They haven't determined
the amount of fuel required yet.
-Fuel required to launch a given [1m[37mmodule[0m is based on its [1m[37mmass[0m.
-Specifically, to find the fuel required for a module, take its mass, divide by three, round down,
-and subtract 2.
+Fuel required to launch a given [1m[97mmodule[0m is based on its [1m[97mmass[0m. Specifically, to find the fuel
+required for a module, take its mass, divide by three, round down, and subtract 2.
For example:
- For a mass of 12, divide by 3 and round down to get 4, then subtract 2 to get 2.
+
- For a mass of 14, dividing by 3 and rounding down still yields 4, so the fuel required is also 2.
+
- For a mass of 1969, the fuel required is 654.
+
- For a mass of 100756, the fuel required is 33583.
@@ -31,6 +32,6 @@ The Fuel Counter-Upper needs to know the total fuel requirement. To find it, in
the fuel needed for the mass of each module (your puzzle input), then add together all the fuel
values.
-[1m[37mWhat is the sum of the fuel requirements[0m for all of the modules on your spacecraft?
+[1m[97mWhat is the sum of the fuel requirements[0m for all of the modules on your spacecraft?
diff --git a/01/part2 b/01/part2
@@ -4,10 +4,10 @@ During the second Go / No Go poll, the Elf in charge of the Rocket Equation Doub
launch sequence. Apparently, you forgot to include additional fuel for the fuel you just added.
Fuel itself requires fuel just like a module - take its mass, divide by three, round down, and
-subtract 2. However, that fuel [1m[37malso[0m requires fuel, and [1m[37mthat[0m fuel requires
-fuel, and so on. Any mass that would require [1m[37mnegative fuel[0m should instead be treated
-as if it requires [1m[37mzero fuel[0m; the remaining mass, if any, is instead handled by
-[1m[37mwishing really hard[0m, which has no mass and is outside the scope of this calculation.
+subtract 2. However, that fuel [1m[97malso[0m requires fuel, and [1m[97mthat[0m fuel requires fuel, and so on. Any
+mass that would require [1m[97mnegative fuel[0m should instead be treated as if it requires [1m[97mzero fuel[0m; the
+remaining mass, if any, is instead handled by [1m[97mwishing really hard[0m, which has no mass and is outside
+the scope of this calculation.
So, for each module mass, calculate its fuel and add it to the total. Then, treat the fuel amount
you just calculated as the input mass and repeat the process, continuing until a fuel requirement is
@@ -17,16 +17,18 @@ zero or negative. For example:
- A module of mass 14 requires 2 fuel. This fuel requires no further fuel (2 divided by 3 and
rounded down is 0, which would call for a negative fuel), so the total fuel required is still just
2.
+
- At first, a module of mass 1969 requires 654 fuel. Then, this fuel requires 216 more fuel (654 /
3 - 2). 216 then requires 70 more fuel, which requires 21 fuel, which requires 5 fuel, which
requires no further fuel. So, the total fuel required for a module of mass 1969 is 654 + 216 + 70 +
21 + 5 = 966.
+
- The fuel required by a module of mass 100756 and its fuel is: 33583 + 11192 + 3728 + 1240 + 411 +
135 + 43 + 12 + 2 = 50346.
-[1m[37mWhat is the sum of the fuel requirements[0m for all of the modules on your spacecraft when
-also taking into account the mass of the added fuel? (Calculate the fuel requirements for each
-module separately, then add them all up at the end.)
+[1m[97mWhat is the sum of the fuel requirements[0m for all of the modules on your spacecraft when also taking
+into account the mass of the added fuel? (Calculate the fuel requirements for each module
+separately, then add them all up at the end.)
diff --git a/02/part1 b/02/part1
@@ -5,28 +5,27 @@ program alarm". On the radio, an Elf is already explaining how to handle the sit
worry, that's perfectly norma--" The ship computer bursts into flames.
You notify the Elves that the computer's magic smoke seems to have escaped. "That computer ran
-[1m[37mIntcode[0m programs like the gravity assist program it was working on; surely there are
-enough spare parts up there to build a new Intcode computer!"
+[1m[97mIntcode[0m programs like the gravity assist program it was working on; surely there are enough spare
+parts up there to build a new Intcode computer!"
An Intcode program is a list of integers separated by commas (like 1,0,0,3,99). To run one, start
-by looking at the first integer (called position 0). Here, you will find an [1m[37mopcode[0m -
-either 1, 2, or 99. The opcode indicates what to do; for example, 99 means that the program is
-finished and should immediately halt. Encountering an unknown opcode means something went wrong.
+by looking at the first integer (called position 0). Here, you will find an [1m[97mopcode[0m - either 1, 2, or
+99. The opcode indicates what to do; for example, 99 means that the program is finished and should
+immediately halt. Encountering an unknown opcode means something went wrong.
-Opcode 1 [1m[37madds[0m together numbers read from two positions and stores the result in a third
-position. The three integers [1m[37mimmediately after[0m the opcode tell you these three
-positions - the first two indicate the [1m[37mpositions[0m from which you should read the input
-values, and the third indicates the [1m[37mposition[0m at which the output should be stored.
+Opcode 1 [1m[97madds[0m together numbers read from two positions and stores the result in a third position.
+The three integers [1m[97mimmediately after[0m the opcode tell you these three positions - the first two
+indicate the [1m[97mpositions[0m from which you should read the input values, and the third indicates the
+[1m[97mposition[0m at which the output should be stored.
For example, if your Intcode computer encounters 1,10,20,30, it should read the values at positions
10 and 20, add those values, and then overwrite the value at position 30 with their sum.
-Opcode 2 works exactly like opcode 1, except it [1m[37mmultiplies[0m the two inputs instead of
-adding them. Again, the three integers after the opcode indicate [1m[37mwhere[0m the inputs and
-outputs are, not their values.
+Opcode 2 works exactly like opcode 1, except it [1m[97mmultiplies[0m the two inputs instead of adding them.
+Again, the three integers after the opcode indicate [1m[97mwhere[0m the inputs and outputs are, not their
+values.
-Once you're done processing an opcode, [1m[37mmove to the next one[0m by stepping forward 4
-positions.
+Once you're done processing an opcode, [1m[97mmove to the next one[0m by stepping forward 4 positions.
For example, suppose you have the following program:
@@ -41,11 +40,11 @@ For the purposes of illustration, here is the same program split into multiple l
The first four integers, 1,9,10,3, are at positions 0, 1, 2, and 3. Together, they represent the
first opcode (1, addition), the positions of the two inputs (9 and 10), and the position of the
output (3). To handle this opcode, you first need to get the values at the input positions:
-position 9 contains 30, and position 10 contains 40. [1m[37mAdd[0m these numbers together to get
-70. Then, store this value at the output position; here, the output position (3) is [1m[37mat[0m
-position 3, so it overwrites itself. Afterward, the program looks like this:
+position 9 contains 30, and position 10 contains 40. [1m[97mAdd[0m these numbers together to get 70. Then,
+store this value at the output position; here, the output position (3) is [1m[97mat[0m position 3, so it
+overwrites itself. Afterward, the program looks like this:
-1,9,10,[1m[37m70[0m,
+1,9,10,[1m[97m70[0m,
2,3,11,0,
99,
30,40,50
@@ -54,7 +53,7 @@ Step forward 4 positions to reach the next opcode, 2. This opcode works just lik
it multiplies instead of adding. The inputs are at positions 3 and 11; these positions contain 70
and 50 respectively. Multiplying these produces 3500; this is stored at position 0:
-[1m[37m3500[0m,9,10,70,
+[1m[97m3500[0m,9,10,70,
2,3,11,0,
99,
30,40,50
@@ -64,15 +63,18 @@ Stepping forward 4 more positions arrives at opcode 99, halting the program.
Here are the initial and final states of a few more small programs:
- - 1,0,0,0,99 becomes [1m[37m2[0m,0,0,0,99 (1 + 1 = 2).
- - 2,3,0,3,99 becomes 2,3,0,[1m[37m6[0m,99 (3 * 2 = 6).
- - 2,4,4,5,99,0 becomes 2,4,4,5,99,[1m[37m9801[0m (99 * 99 = 9801).
- - 1,1,1,4,99,5,6,0,99 becomes [1m[37m30[0m,1,1,4,[1m[37m2[0m,5,6,0,99.
+ - 1,0,0,0,99 becomes [1m[97m2[0m,0,0,0,99 (1 + 1 = 2).
+
+ - 2,3,0,3,99 becomes 2,3,0,[1m[97m6[0m,99 (3 * 2 = 6).
+
+ - 2,4,4,5,99,0 becomes 2,4,4,5,99,[1m[97m9801[0m (99 * 99 = 9801).
+
+ - 1,1,1,4,99,5,6,0,99 becomes [1m[97m30[0m,1,1,4,[1m[97m2[0m,5,6,0,99.
Once you have a working computer, the first step is to restore the gravity assist program (your
puzzle input) to the "1202 program alarm" state it had just before the last computer caught fire. To
-do this, [1m[37mbefore running the program[0m, replace position 1 with the value 12 and replace
-position 2 with the value 2. [1m[37mWhat value is left at position 0[0m after the program halts?
+do this, [1m[97mbefore running the program[0m, replace position 1 with the value 12 and replace position 2
+with the value 2. [1m[97mWhat value is left at position 0[0m after the program halts?
diff --git a/02/part2 b/02/part2
@@ -1,42 +1,41 @@
--- Part Two ---
-"Good, the new computer seems to be working correctly! [1m[37mKeep it nearby[0m during this
-mission - you'll probably use it again. Real Intcode computers support many more features than your
-new one, but we'll let you know what they are as you need them."
+"Good, the new computer seems to be working correctly! [1m[97mKeep it nearby[0m during this mission - you'll
+probably use it again. Real Intcode computers support many more features than your new one, but
+we'll let you know what they are as you need them."
"However, your current priority should be to complete your gravity assist around the Moon. For this
mission to succeed, we should settle on some terminology for the parts you've already built."
Intcode programs are given as a list of integers; these values are used as the initial state for the
-computer's [1m[37mmemory[0m. When you run an Intcode program, make sure to start by initializing
-memory to the program's values. A position in memory is called an [1m[37maddress[0m (for example,
-the first value in memory is at "address 0").
+computer's [1m[97mmemory[0m. When you run an Intcode program, make sure to start by initializing memory to the
+program's values. A position in memory is called an [1m[97maddress[0m (for example, the first value in memory
+is at "address 0").
-Opcodes (like 1, 2, or 99) mark the beginning of an [1m[37minstruction[0m. The values used
-immediately after an opcode, if any, are called the instruction's [1m[37mparameters[0m. For
-example, in the instruction 1,2,3,4, 1 is the opcode; 2, 3, and 4 are the parameters. The
-instruction 99 contains only an opcode and has no parameters.
+Opcodes (like 1, 2, or 99) mark the beginning of an [1m[97minstruction[0m. The values used immediately after
+an opcode, if any, are called the instruction's [1m[97mparameters[0m. For example, in the instruction
+1,2,3,4, 1 is the opcode; 2, 3, and 4 are the parameters. The instruction 99 contains only an opcode
+and has no parameters.
-The address of the current instruction is called the [1m[37minstruction pointer[0m; it starts at
-0. After an instruction finishes, the instruction pointer increases by [1m[37mthe number of
-values in the instruction[0m; until you add more instructions to the computer, this is always 4 (1
-opcode + 3 parameters) for the add and multiply instructions. (The halt instruction would increase
-the instruction pointer by 1, but it halts the program instead.)
+The address of the current instruction is called the [1m[97minstruction pointer[0m; it starts at 0. After an
+instruction finishes, the instruction pointer increases by [1m[97mthe number of values in the
+instruction[0m; until you add more instructions to the computer, this is always 4 (1 opcode + 3
+parameters) for the add and multiply instructions. (The halt instruction would increase the
+instruction pointer by 1, but it halts the program instead.)
"With terminology out of the way, we're ready to proceed. To complete the gravity assist, you need
-to [1m[37mdetermine what pair of inputs produces the output 19690720[0m."
+to [1m[97mdetermine what pair of inputs produces the output 19690720[0m."
The inputs should still be provided to the program by replacing the values at addresses 1 and 2,
-just like before. In this program, the value placed in address 1 is called the [1m[37mnoun[0m,
-and the value placed in address 2 is called the [1m[37mverb[0m. Each of the two input values
-will be between 0 and 99, inclusive.
+just like before. In this program, the value placed in address 1 is called the [1m[97mnoun[0m, and the value
+placed in address 2 is called the [1m[97mverb[0m. Each of the two input values will be between 0 and 99,
+inclusive.
Once the program has halted, its output is available at address 0, also just like before. Each time
-you try a pair of inputs, make sure you first [1m[37mreset the computer's memory to the values in
-the program[0m (your puzzle input) - in other words, don't reuse memory from a previous attempt.
+you try a pair of inputs, make sure you first [1m[97mreset the computer's memory to the values in the
+program[0m (your puzzle input) - in other words, don't reuse memory from a previous attempt.
-Find the input [1m[37mnoun[0m and [1m[37mverb[0m that cause the program to produce the output
-19690720. [1m[37mWhat is 100 * noun + verb?[0m (For example, if noun=12 and verb=2, the answer
-would be 1202.)
+Find the input [1m[97mnoun[0m and [1m[97mverb[0m that cause the program to produce the output 19690720. [1m[97mWhat is 100 *
+noun + verb?[0m (For example, if noun=12 and verb=2, the answer would be 1202.)
diff --git a/03/part1 b/03/part1
@@ -4,15 +4,15 @@ The gravity assist was successful, and you're well on your way to the Venus refu
During the rush back on Earth, the fuel management system wasn't completely installed, so that's
next on the priority list.
-Opening the front panel reveals a jumble of wires. Specifically, [1m[37mtwo wires[0m are
-connected to a central port and extend outward on a grid. You trace the path each wire takes as it
-leaves the central port, one wire per line of text (your puzzle input).
+Opening the front panel reveals a jumble of wires. Specifically, [1m[97mtwo wires[0m are connected to a
+central port and extend outward on a grid. You trace the path each wire takes as it leaves the
+central port, one wire per line of text (your puzzle input).
The wires twist and turn, but the two wires occasionally cross paths. To fix the circuit, you need
-to [1m[37mfind the intersection point closest to the central port[0m. Because the wires are on a
-grid, use the Manhattan distance for this measurement. While the wires do technically cross right at
-the central port where they both start, this point does not count, nor does a wire count as crossing
-with itself.
+to [1m[97mfind the intersection point closest to the central port[0m. Because the wires are on a grid, use the
+Manhattan distance for this measurement. While the wires do technically cross right at the central
+port where they both start, this point does not count, nor does a wire count as crossing with
+itself.
For example, if the first wire's path is R8,U5,L5,D3, then starting from the central port (o), it
goes right 8, up 5, left 5, and finally down 3:
@@ -35,7 +35,7 @@ Then, if the second wire's path is U7,R6,D4,L4, it goes up 7, right 6, down 4, a
.|.....|...
.|..+--X-+.
.|..|..|.|.
-.|.-[1m[37mX[0m--+.|.
+.|.-[1m[97mX[0m--+.|.
.|..|....|.
.|.......|.
.o-------+.
@@ -54,6 +54,6 @@ U62,R66,U55,R34,D71,R55,D58,R83 = distance 159
U98,R91,D20,R16,D67,R40,U7,R15,U6,R7 = distance 135
-[1m[37mWhat is the Manhattan distance[0m from the central port to the closest intersection?
+[1m[97mWhat is the Manhattan distance[0m from the central port to the closest intersection?
diff --git a/03/part2 b/03/part2
@@ -1,12 +1,12 @@
--- Part Two ---
-It turns out that this circuit is very timing-sensitive; you actually need to [1m[37mminimize the
-signal delay[0m.
+It turns out that this circuit is very timing-sensitive; you actually need to [1m[97mminimize the signal
+delay[0m.
-To do this, calculate the [1m[37mnumber of steps[0m each wire takes to reach each intersection;
-choose the intersection where the [1m[37msum of both wires' steps[0m is lowest. If a wire visits
-a position on the grid multiple times, use the steps value from the [1m[37mfirst[0m time it
-visits that position when calculating the total value of a specific intersection.
+To do this, calculate the [1m[97mnumber of steps[0m each wire takes to reach each intersection; choose the
+intersection where the [1m[97msum of both wires' steps[0m is lowest. If a wire visits a position on the grid
+multiple times, use the steps value from the [1m[97mfirst[0m time it visits that position when calculating the
+total value of a specific intersection.
The number of steps a wire takes is the total number of grid squares the wire has entered to get to
that location, including the intersection being considered. Again consider the example from above:
@@ -23,11 +23,11 @@ that location, including the intersection being considered. Again consider the e
...........
In the above example, the intersection closest to the central port is reached after 8+5+5+2 =
-[1m[37m20[0m steps by the first wire and 7+6+4+3 = [1m[37m20[0m steps by the second wire for a
-total of 20+20 = [1m[37m40[0m steps.
+[1m[97m20[0m steps by the first wire and 7+6+4+3 = [1m[97m20[0m steps by the second wire for a total of 20+20 =
+[1m[97m40[0m steps.
-However, the top-right intersection is better: the first wire takes only 8+5+2 = [1m[37m15[0m and
-the second wire takes only 7+6+2 = [1m[37m15[0m, a total of 15+15 = [1m[37m30[0m steps.
+However, the top-right intersection is better: the first wire takes only 8+5+2 = [1m[97m15[0m and the second
+wire takes only 7+6+2 = [1m[97m15[0m, a total of 15+15 = [1m[97m30[0m steps.
Here are the best steps for the extra examples from above:
@@ -39,6 +39,6 @@ U62,R66,U55,R34,D71,R55,D58,R83 = 610 steps
U98,R91,D20,R16,D67,R40,U7,R15,U6,R7 = 410 steps
-[1m[37mWhat is the fewest combined steps the wires must take to reach an intersection?[0m
+[1m[97mWhat is the fewest combined steps the wires must take to reach an intersection?[0m
diff --git a/04/part1 b/04/part1
@@ -10,10 +10,10 @@ However, they do remember a few key facts about the password:
- The value is within the range given in your puzzle input.
- - Two adjacent digits are the same (like 22 in 1[1m[37m22[0m345).
+ - Two adjacent digits are the same (like 22 in 1[1m[97m22[0m345).
- - Going from left to right, the digits [1m[37mnever decrease[0m; they only ever increase or stay
-the same (like 111123 or 135679).
+ - Going from left to right, the digits [1m[97mnever decrease[0m; they only ever increase or stay the same
+(like 111123 or 135679).
Other than the range rule, the following are true:
@@ -21,12 +21,11 @@ Other than the range rule, the following are true:
- 111111 meets these criteria (double 11, never decreases).
- - 2234[1m[37m50[0m does not meet these criteria (decreasing pair of digits 50).
+ - 2234[1m[97m50[0m does not meet these criteria (decreasing pair of digits 50).
- 123789 does not meet these criteria (no double).
-[1m[37mHow many different passwords[0m within the range given in your puzzle input meet these
-criteria?
+[1m[97mHow many different passwords[0m within the range given in your puzzle input meet these criteria?
diff --git a/04/part2 b/04/part2
@@ -1,7 +1,7 @@
--- Part Two ---
-An Elf just remembered one more important detail: the two adjacent matching digits [1m[37mare not
-part of a larger group of matching digits[0m.
+An Elf just remembered one more important detail: the two adjacent matching digits [1m[97mare not part of a
+larger group of matching digits[0m.
Given this additional criterion, but still ignoring the range rule, the following are now true:
@@ -9,14 +9,12 @@ Given this additional criterion, but still ignoring the range rule, the followin
- 112233 meets these criteria because the digits never decrease and all repeated digits are exactly
two digits long.
- - 123[1m[37m444[0m no longer meets the criteria (the repeated 44 is part of a larger group of
-444).
+ - 123[1m[97m444[0m no longer meets the criteria (the repeated 44 is part of a larger group of 444).
- 111122 meets the criteria (even though 1 is repeated more than twice, it still contains a double
22).
-[1m[37mHow many different passwords[0m within the range given in your puzzle input meet all of
-the criteria?
+[1m[97mHow many different passwords[0m within the range given in your puzzle input meet all of the criteria?
diff --git a/05/part1 b/05/part1
@@ -4,36 +4,34 @@ You're starting to sweat as the ship makes its way toward Mercury. The Elves su
the air conditioner working by upgrading your ship computer to support the Thermal Environment
Supervision Terminal.
-The Thermal Environment Supervision Terminal (TEST) starts by running a [1m[37mdiagnostic
-program[0m (your puzzle input). The TEST diagnostic program will run on your existing Intcode
-computer after a few modifications:
+The Thermal Environment Supervision Terminal (TEST) starts by running a [1m[97mdiagnostic program[0m (your
+puzzle input). The TEST diagnostic program will run on your existing Intcode computer after a few
+modifications:
-[1m[37mFirst[0m, you'll need to add [1m[37mtwo new instructions[0m:
+[1m[97mFirst[0m, you'll need to add [1m[97mtwo new instructions[0m:
- - Opcode 3 takes a single integer as [1m[37minput[0m and saves it to the position given by its
-only parameter. For example, the instruction 3,50 would take an input value and store it at address
-50.
+ - Opcode 3 takes a single integer as [1m[97minput[0m and saves it to the position given by its only
+parameter. For example, the instruction 3,50 would take an input value and store it at address 50.
- - Opcode 4 [1m[37moutputs[0m the value of its only parameter. For example, the instruction 4,50
-would output the value at address 50.
+ - Opcode 4 [1m[97moutputs[0m the value of its only parameter. For example, the instruction 4,50 would output
+the value at address 50.
Programs that use these instructions will come with documentation that explains what should be
connected to the input and output. The program 3,0,4,0,99 outputs whatever it gets as input, then
halts.
-[1m[37mSecond[0m, you'll need to add support for [1m[37mparameter modes[0m:
+[1m[97mSecond[0m, you'll need to add support for [1m[97mparameter modes[0m:
Each parameter of an instruction is handled based on its parameter mode. Right now, your ship
-computer already understands parameter mode 0, [1m[37mposition mode[0m, which causes the
-parameter to be interpreted as a [1m[37mposition[0m - if the parameter is 50, its value is
-[1m[37mthe value stored at address 50 in memory[0m. Until now, all parameters have been in
-position mode.
+computer already understands parameter mode 0, [1m[97mposition mode[0m, which causes the parameter to be
+interpreted as a [1m[97mposition[0m - if the parameter is 50, its value is [1m[97mthe value stored at address 50 in
+memory[0m. Until now, all parameters have been in position mode.
-Now, your ship computer will also need to handle parameters in mode 1, [1m[37mimmediate mode[0m.
-In immediate mode, a parameter is interpreted as a [1m[37mvalue[0m - if the parameter is 50, its
-value is simply [1m[37m50[0m.
+Now, your ship computer will also need to handle parameters in mode 1, [1m[97mimmediate mode[0m. In immediate
+mode, a parameter is interpreted as a [1m[97mvalue[0m - if the parameter is 50, its value is simply
+[1m[97m50[0m.
Parameter modes are stored in the same value as the instruction's opcode. The opcode is a two-digit
number based only on the ones and tens digit of the value, that is, the opcode is the rightmost two
@@ -44,10 +42,9 @@ digit, and so on. Any missing modes are 0.
For example, consider the program 1002,4,3,4,33.
-The first instruction, 1002,4,3,4, is a [1m[37mmultiply[0m instruction - the rightmost two digits
-of the first value, 02, indicate opcode 2, multiplication. Then, going right to left, the parameter
-modes are 0 (hundreds digit), 1 (thousands digit), and 0 (ten-thousands digit, not present and
-therefore zero):
+The first instruction, 1002,4,3,4, is a [1m[97mmultiply[0m instruction - the rightmost two digits of the first
+value, 02, indicate opcode 2, multiplication. Then, going right to left, the parameter modes are 0
+(hundreds digit), 1 (thousands digit), and 0 (ten-thousands digit, not present and therefore zero):
ABCDE
1002
@@ -64,35 +61,33 @@ in immediate mode, simply has value 3. The result of this operation, 33 * 3 = 99
according to the third parameter, 4 in position mode, which also works like it did before - 99 is
written to address 4.
-Parameters that an instruction writes to will [1m[37mnever be in immediate mode[0m.
+Parameters that an instruction writes to will [1m[97mnever be in immediate mode[0m.
-[1m[37mFinally[0m, some notes:
+[1m[97mFinally[0m, some notes:
- - It is important to remember that the instruction pointer should increase by [1m[37mthe number
-of values in the instruction[0m after the instruction finishes. Because of the new instructions,
-this amount is no longer always 4.
+ - It is important to remember that the instruction pointer should increase by [1m[97mthe number of values
+in the instruction[0m after the instruction finishes. Because of the new instructions, this amount is
+no longer always 4.
- Integers can be negative: 1101,100,-1,4,0 is a valid program (find 100 + -1, store the result in
position 4).
The TEST diagnostic program will start by requesting from the user the ID of the system to test by
-running an [1m[37minput[0m instruction - provide it 1, the ID for the ship's air conditioner
-unit.
+running an [1m[97minput[0m instruction - provide it 1, the ID for the ship's air conditioner unit.
It will then perform a series of diagnostic tests confirming that various parts of the Intcode
computer, like parameter modes, function correctly. For each test, it will run an
-[1m[37moutput[0m instruction indicating how far the result of the test was from the expected
-value, where 0 means the test was successful. Non-zero outputs mean that a function is not working
-correctly; check the instructions that were run before the output instruction to see which one
-failed.
+[1m[97moutput[0m instruction indicating how far the result of the test was from the expected value, where 0
+means the test was successful. Non-zero outputs mean that a function is not working correctly;
+check the instructions that were run before the output instruction to see which one failed.
-Finally, the program will output a [1m[37mdiagnostic code[0m and immediately halt. This final
-output isn't an error; an output followed immediately by a halt means the program finished. If all
-outputs were zero except the diagnostic code, the diagnostic program ran successfully.
+Finally, the program will output a [1m[97mdiagnostic code[0m and immediately halt. This final output isn't an
+error; an output followed immediately by a halt means the program finished. If all outputs were
+zero except the diagnostic code, the diagnostic program ran successfully.
-After providing 1 to the only input instruction and passing all the tests, [1m[37mwhat diagnostic
-code does the program produce?[0m
+After providing 1 to the only input instruction and passing all the tests, [1m[97mwhat diagnostic code does
+the program produce?[0m
diff --git a/05/part2 b/05/part2
@@ -2,7 +2,7 @@
The air conditioner comes online! Its cold air feels good for a while, but then the TEST alarms
start to go off. Since the air conditioner can't vent its heat anywhere but back into the
-spacecraft, it's actually making the air inside the ship [1m[37mwarmer[0m.
+spacecraft, it's actually making the air inside the ship [1m[97mwarmer[0m.
Instead, you'll need to use the TEST to extend the thermal radiators. Fortunately, the diagnostic
program (your puzzle input) is already equipped for this. Unfortunately, your Intcode computer is
@@ -11,50 +11,49 @@ not.
Your computer is only missing a few opcodes:
- - Opcode 5 is [1m[37mjump-if-true[0m: if the first parameter is [1m[37mnon-zero[0m, it sets
-the instruction pointer to the value from the second parameter. Otherwise, it does nothing.
+ - Opcode 5 is [1m[97mjump-if-true[0m: if the first parameter is [1m[97mnon-zero[0m, it sets the instruction pointer to
+the value from the second parameter. Otherwise, it does nothing.
- - Opcode 6 is [1m[37mjump-if-false[0m: if the first parameter [1m[37mis zero[0m, it sets the
-instruction pointer to the value from the second parameter. Otherwise, it does nothing.
+ - Opcode 6 is [1m[97mjump-if-false[0m: if the first parameter [1m[97mis zero[0m, it sets the instruction pointer to the
+value from the second parameter. Otherwise, it does nothing.
- - Opcode 7 is [1m[37mless than[0m: if the first parameter is [1m[37mless than[0m the second
-parameter, it stores 1 in the position given by the third parameter. Otherwise, it stores 0.
+ - Opcode 7 is [1m[97mless than[0m: if the first parameter is [1m[97mless than[0m the second parameter, it stores 1 in
+the position given by the third parameter. Otherwise, it stores 0.
- - Opcode 8 is [1m[37mequals[0m: if the first parameter is [1m[37mequal to[0m the second
-parameter, it stores 1 in the position given by the third parameter. Otherwise, it stores 0.
+ - Opcode 8 is [1m[97mequals[0m: if the first parameter is [1m[97mequal to[0m the second parameter, it stores 1 in the
+position given by the third parameter. Otherwise, it stores 0.
-Like all instructions, these instructions need to support [1m[37mparameter modes[0m as described
-above.
+Like all instructions, these instructions need to support [1m[97mparameter modes[0m as described above.
Normally, after an instruction is finished, the instruction pointer increases by the number of
-values in that instruction. [1m[37mHowever[0m, if the instruction modifies the instruction
-pointer, that value is used and the instruction pointer is [1m[37mnot automatically increased[0m.
+values in that instruction. [1m[97mHowever[0m, if the instruction modifies the instruction pointer, that value
+is used and the instruction pointer is [1m[97mnot automatically increased[0m.
For example, here are several programs that take one input, compare it to the value 8, and then
produce one output:
- - 3,9,8,9,10,9,4,9,99,-1,8 - Using [1m[37mposition mode[0m, consider whether the input is
-[1m[37mequal to[0m 8; output 1 (if it is) or 0 (if it is not).
+ - 3,9,8,9,10,9,4,9,99,-1,8 - Using [1m[97mposition mode[0m, consider whether the input is [1m[97mequal to[0m 8; output
+1 (if it is) or 0 (if it is not).
- - 3,9,7,9,10,9,4,9,99,-1,8 - Using [1m[37mposition mode[0m, consider whether the input is
-[1m[37mless than[0m 8; output 1 (if it is) or 0 (if it is not).
+ - 3,9,7,9,10,9,4,9,99,-1,8 - Using [1m[97mposition mode[0m, consider whether the input is [1m[97mless than[0m 8; output
+1 (if it is) or 0 (if it is not).
- - 3,3,1108,-1,8,3,4,3,99 - Using [1m[37mimmediate mode[0m, consider whether the input is
-[1m[37mequal to[0m 8; output 1 (if it is) or 0 (if it is not).
+ - 3,3,1108,-1,8,3,4,3,99 - Using [1m[97mimmediate mode[0m, consider whether the input is [1m[97mequal to[0m 8; output 1
+(if it is) or 0 (if it is not).
- - 3,3,1107,-1,8,3,4,3,99 - Using [1m[37mimmediate mode[0m, consider whether the input is
-[1m[37mless than [0m8; output 1 (if it is) or 0 (if it is not).
+ - 3,3,1107,-1,8,3,4,3,99 - Using [1m[97mimmediate mode[0m, consider whether the input is [1m[97mless than [0m8; output
+1 (if it is) or 0 (if it is not).
Here are some jump tests that take an input, then output 0 if the input was zero or 1 if the input
was non-zero:
- - 3,12,6,12,15,1,13,14,13,4,13,99,-1,0,1,9 (using [1m[37mposition mode[0m)
+ - 3,12,6,12,15,1,13,14,13,4,13,99,-1,0,1,9 (using [1m[97mposition mode[0m)
- - 3,3,1105,-1,9,1101,0,0,12,4,12,99,1 (using [1m[37mimmediate mode[0m)
+ - 3,3,1105,-1,9,1101,0,0,12,4,12,99,1 (using [1m[97mimmediate mode[0m)
Here's a larger example:
@@ -68,9 +67,9 @@ then output 999 if the input value is below 8, output 1000 if the input value is
output 1001 if the input value is greater than 8.
This time, when the TEST diagnostic program runs its input instruction to get the ID of the system
-to test, [1m[37mprovide it 5[0m, the ID for the ship's thermal radiator controller. This
-diagnostic test suite only outputs one number, the [1m[37mdiagnostic code[0m.
+to test, [1m[97mprovide it 5[0m, the ID for the ship's thermal radiator controller. This diagnostic test suite
+only outputs one number, the [1m[97mdiagnostic code[0m.
-[1m[37mWhat is the diagnostic code for system ID 5?[0m
+[1m[97mWhat is the diagnostic code for system ID 5?[0m
diff --git a/06/part1 b/06/part1
@@ -22,12 +22,11 @@ with lines) is only partly shown. In the map data, this orbital relationship is
which means "BBB is in orbit around AAA".
Before you use your map data to plot a course, you need to make sure it wasn't corrupted during the
-download. To verify maps, the Universal Orbit Map facility uses [1m[37morbit count checksums[0m
-- the total number of [1m[37mdirect orbits[0m (like the one shown above) and [1m[37mindirect
-orbits[0m.
+download. To verify maps, the Universal Orbit Map facility uses [1m[97morbit count checksums[0m - the total
+number of [1m[97mdirect orbits[0m (like the one shown above) and [1m[97mindirect orbits[0m.
-Whenever A orbits B and B orbits C, then A [1m[37mindirectly orbits[0m C. This chain can be any
-number of objects long: if A orbits B, B orbits C, and C orbits D, then A indirectly orbits D.
+Whenever A orbits B and B orbits C, then A [1m[97mindirectly orbits[0m C. This chain can be any number of
+objects long: if A orbits B, B orbits C, and C orbits D, then A indirectly orbits D.
For example, suppose you have the following map:
COM)B
@@ -63,9 +62,9 @@ Here, we can count the total number of orbits as follows:
- COM orbits nothing.
-The total number of direct and indirect orbits in this example is [1m[37m42[0m.
+The total number of direct and indirect orbits in this example is [1m[97m42[0m.
-[1m[37mWhat is the total number of direct and indirect orbits[0m in your map data?
+[1m[97mWhat is the total number of direct and indirect orbits[0m in your map data?
diff --git a/06/part2 b/06/part2
@@ -1,7 +1,7 @@
--- Part Two ---
-Now, you just need to figure out how many [1m[37morbital transfers[0m you (YOU) need to take to
-get to Santa (SAN).
+Now, you just need to figure out how many [1m[97morbital transfers[0m you (YOU) need to take to get to Santa
+(SAN).
You start at the object YOU are orbiting; your destination is the object SAN is orbiting. An orbital
transfer lets you move from any object to an object orbiting or orbited by that object.
@@ -24,13 +24,13 @@ I)SAN
Visually, the above map of orbits looks like this:
- [1m[37mYOU[0m
- [1m[37m/[0m
- G - H [1m[37mJ - K[0m - L
- / [1m[37m/[0m
-COM - B - C - [1m[37mD - E[0m - F
- [1m[37m\[0m
- [1m[37mI - SAN[0m
+ [1m[97mYOU[0m
+ [1m[97m/[0m
+ G - H [1m[97mJ - K[0m - L
+ / [1m[97m/[0m
+COM - B - C - [1m[97mD - E[0m - F
+ [1m[97m\[0m
+ [1m[97mI - SAN[0m
In this example, YOU are in orbit around K, and SAN is in orbit around I. To move from K to I, a
minimum of 4 orbital transfers are required:
@@ -52,11 +52,10 @@ Afterward, the map of orbits looks like this:
COM - B - C - D - E - F
\
I - SAN
- [1m[37m\[0m
- [1m[37mYOU[0m
+ [1m[97m\[0m
+ [1m[97mYOU[0m
-[1m[37mWhat is the minimum number of orbital transfers required[0m to move from the object YOU
-are orbiting to the object SAN is orbiting? (Between the objects they are orbiting -
-[1m[37mnot[0m between YOU and SAN.)
+[1m[97mWhat is the minimum number of orbital transfers required[0m to move from the object YOU are orbiting to
+the object SAN is orbiting? (Between the objects they are orbiting - [1m[97mnot[0m between YOU and SAN.)
diff --git a/07/part1 b/07/part1
@@ -14,22 +14,20 @@ thrusters.
0 ->| Amp A |->| Amp B |->| Amp C |->| Amp D |->| Amp E |-> (to thrusters)
O-------O O-------O O-------O O-------O O-------O
-The Elves have sent you some [1m[37mAmplifier Controller Software[0m (your puzzle input), a
-program that should run on your existing Intcode computer. Each amplifier will need to run a copy of
-the program.
+The Elves have sent you some [1m[97mAmplifier Controller Software[0m (your puzzle input), a program that
+should run on your existing Intcode computer. Each amplifier will need to run a copy of the program.
When a copy of the program starts running on an amplifier, it will first use an input instruction to
-ask the amplifier for its current [1m[37mphase setting[0m (an integer from 0 to 4). Each phase
-setting is used [1m[37mexactly once[0m, but the Elves can't remember which amplifier needs which
-phase setting.
+ask the amplifier for its current [1m[97mphase setting[0m (an integer from 0 to 4). Each phase setting is used
+[1m[97mexactly once[0m, but the Elves can't remember which amplifier needs which phase setting.
The program will then call another input instruction to get the amplifier's input signal, compute
the correct output signal, and supply it back to the amplifier with an output instruction. (If the
amplifier has not yet received an input signal, it waits until one arrives.)
-Your job is to [1m[37mfind the largest output signal that can be sent to the thrusters[0m by
-trying every possible combination of phase settings on the amplifiers. Make sure that memory is not
-shared or reused between copies of the program.
+Your job is to [1m[97mfind the largest output signal that can be sent to the thrusters[0m by trying every
+possible combination of phase settings on the amplifiers. Make sure that memory is not shared or
+reused between copies of the program.
For example, suppose you want to try the phase setting sequence 3,1,2,4,0, which would mean setting
amplifier A to phase setting 3, amplifier B to setting 1, C to 2, D to 4, and E to 0. Then, you
@@ -63,19 +61,19 @@ thrusters.
Here are some example programs:
- - Max thruster signal [1m[37m43210[0m (from phase setting sequence 4,3,2,1,0):
+ - Max thruster signal [1m[97m43210[0m (from phase setting sequence 4,3,2,1,0):
3,15,3,16,1002,16,10,16,1,16,15,15,4,15,99,0,0
- - Max thruster signal [1m[37m54321[0m (from phase setting sequence 0,1,2,3,4):
+ - Max thruster signal [1m[97m54321[0m (from phase setting sequence 0,1,2,3,4):
3,23,3,24,1002,24,10,24,1002,23,-1,23,
101,5,23,23,1,24,23,23,4,23,99,0,0
- - Max thruster signal [1m[37m65210[0m (from phase setting sequence 1,0,4,3,2):
+ - Max thruster signal [1m[97m65210[0m (from phase setting sequence 1,0,4,3,2):
3,31,3,32,1002,32,10,32,1001,31,-2,31,1007,31,0,33,
1002,33,7,33,1,33,31,31,1,32,31,31,4,31,99,0,0,0
-Try every combination of phase settings on the amplifiers. [1m[37mWhat is the highest signal that
-can be sent to the thrusters?[0m
+Try every combination of phase settings on the amplifiers. [1m[97mWhat is the highest signal that can be
+sent to the thrusters?[0m
diff --git a/07/part2 b/07/part2
@@ -2,7 +2,7 @@
It's no good - in this configuration, the amplifiers can't generate a large enough output signal to
produce the thrust you'll need. The Elves quickly talk you through rewiring the amplifiers into a
-[1m[37mfeedback loop[0m:
+[1m[97mfeedback loop[0m:
O-------O O-------O O-------O O-------O O-------O
0 -+->| Amp A |->| Amp B |->| Amp C |->| Amp D |->| Amp E |-.
@@ -14,42 +14,41 @@ produce the thrust you'll need. The Elves quickly talk you through rewiring the
(to thrusters)
Most of the amplifiers are connected as they were before; amplifier A's output is connected to
-amplifier B's input, and so on. [1m[37mHowever,[0m the output from amplifier E is now connected
-into amplifier A's input. This creates the feedback loop: the signal will be sent through the
-amplifiers [1m[37mmany times[0m.
+amplifier B's input, and so on. [1m[97mHowever,[0m the output from amplifier E is now connected into amplifier
+A's input. This creates the feedback loop: the signal will be sent through the amplifiers
+[1m[97mmany times[0m.
-In feedback loop mode, the amplifiers need [1m[37mtotally different phase settings[0m: integers
-from 5 to 9, again each used exactly once. These settings will cause the Amplifier Controller
-Software to repeatedly take input and produce output many times before halting. Provide each
-amplifier its phase setting at its first input instruction; all further input/output instructions
-are for signals.
+In feedback loop mode, the amplifiers need [1m[97mtotally different phase settings[0m: integers from 5 to 9,
+again each used exactly once. These settings will cause the Amplifier Controller Software to
+repeatedly take input and produce output many times before halting. Provide each amplifier its phase
+setting at its first input instruction; all further input/output instructions are for signals.
Don't restart the Amplifier Controller Software on any amplifier during this process. Each one
should continue receiving and sending signals until it halts.
All signals sent or received in this process will be between pairs of amplifiers except the very
first signal and the very last signal. To start the process, a 0 signal is sent to amplifier A's
-input [1m[37mexactly once[0m.
+input [1m[97mexactly once[0m.
Eventually, the software on the amplifiers will halt after they have processed the final loop. When
this happens, the last output signal from amplifier E is sent to the thrusters. Your job is to
-[1m[37mfind the largest output signal that can be sent to the thrusters[0m using the new phase
-settings and feedback loop arrangement.
+[1m[97mfind the largest output signal that can be sent to the thrusters[0m using the new phase settings and
+feedback loop arrangement.
Here are some example programs:
- - Max thruster signal [1m[37m139629729[0m (from phase setting sequence 9,8,7,6,5):
+ - Max thruster signal [1m[97m139629729[0m (from phase setting sequence 9,8,7,6,5):
3,26,1001,26,-4,26,3,27,1002,27,2,27,1,27,26,
27,4,27,1001,28,-1,28,1005,28,6,99,0,0,5
- - Max thruster signal [1m[37m18216[0m (from phase setting sequence 9,7,8,5,6):
+ - Max thruster signal [1m[97m18216[0m (from phase setting sequence 9,7,8,5,6):
3,52,1001,52,-5,52,3,53,1,52,56,54,1007,54,5,55,1005,55,26,1001,54,
-5,54,1105,1,12,1,53,54,53,1008,54,0,55,1001,55,1,55,2,53,55,53,4,
53,1001,56,-1,56,1005,56,6,99,0,0,0,0,10
-Try every combination of the new phase settings on the amplifier feedback loop. [1m[37mWhat is
-the highest signal that can be sent to the thrusters?[0m
+Try every combination of the new phase settings on the amplifier feedback loop. [1m[97mWhat is the highest
+signal that can be sent to the thrusters?[0m
diff --git a/08/part1 b/08/part1
@@ -16,8 +16,8 @@ Images are sent as a series of digits that each represent the color of a single
fill each row of the image left-to-right, then move downward to the next row, filling rows
top-to-bottom until every pixel of the image is filled.
-Each image actually consists of a series of identically-sized [1m[37mlayers[0m that are filled in
-this way. So, the first digit corresponds to the top-left pixel of the first layer, the second digit
+Each image actually consists of a series of identically-sized [1m[97mlayers[0m that are filled in this way.
+So, the first digit corresponds to the top-left pixel of the first layer, the second digit
corresponds to the pixel to the right of that on the same layer, and so on until the last digit,
which corresponds to the bottom-right pixel of the last layer.
@@ -30,10 +30,10 @@ Layer 1: 123
Layer 2: 789
012
-The image you received is [1m[37m25 pixels wide and 6 pixels tall[0m.
+The image you received is [1m[97m25 pixels wide and 6 pixels tall[0m.
To make sure the image wasn't corrupted during transmission, the Elves would like you to find the
-layer that contains the [1m[37mfewest 0 digits[0m. On that layer, what is [1m[37mthe number of
-1 digits multiplied by the number of 2 digits?[0m
+layer that contains the [1m[97mfewest 0 digits[0m. On that layer, what is [1m[97mthe number of 1 digits multiplied
+by the number of 2 digits?[0m
diff --git a/08/part2 b/08/part2
@@ -6,37 +6,34 @@ pixel: 0 is black, 1 is white, and 2 is transparent.
The layers are rendered with the first layer in front and the last layer in back. So, if a given
position has a transparent pixel in the first and second layers, a black pixel in the third layer,
-and a white pixel in the fourth layer, the final image would have a [1m[37mblack[0m pixel at that
-position.
+and a white pixel in the fourth layer, the final image would have a [1m[97mblack[0m pixel at that position.
For example, given an image 2 pixels wide and 2 pixels tall, the image data 0222112222120000
corresponds to the following image layers:
-Layer 1: [1m[37m0[0m2
+Layer 1: [1m[97m0[0m2
22
-Layer 2: 1[1m[37m1[0m
+Layer 2: 1[1m[97m1[0m
22
Layer 3: 22
- [1m[37m1[0m2
+ [1m[97m1[0m2
Layer 4: 00
- 0[1m[37m0[0m
+ 0[1m[97m0[0m
Then, the full image can be found by determining the top visible pixel in each position:
- - The top-left pixel is [1m[37mblack[0m because the top layer is 0.
+ - The top-left pixel is [1m[97mblack[0m because the top layer is 0.
- - The top-right pixel is [1m[37mwhite[0m because the top layer is 2 (transparent), but the
-second layer is 1.
+ - The top-right pixel is [1m[97mwhite[0m because the top layer is 2 (transparent), but the second layer is 1.
- - The bottom-left pixel is [1m[37mwhite[0m because the top two layers are 2, but the third layer
-is 1.
+ - The bottom-left pixel is [1m[97mwhite[0m because the top two layers are 2, but the third layer is 1.
- - The bottom-right pixel is [1m[37mblack[0m because the only visible pixel in that position is 0
-(from layer 4).
+ - The bottom-right pixel is [1m[97mblack[0m because the only visible pixel in that position is 0 (from layer
+4).
So, the final image looks like this:
@@ -44,6 +41,6 @@ So, the final image looks like this:
01
10
-[1m[37mWhat message is produced after decoding your image?[0m
+[1m[97mWhat message is produced after decoding your image?[0m
diff --git a/09/part1 b/09/part1
@@ -4,35 +4,34 @@ You've just said goodbye to the rebooted rover and left Mars when you receive a
signal coming from the asteroid belt. It must be the Ceres monitoring station!
In order to lock on to the signal, you'll need to boost your sensors. The Elves send up the latest
-[1m[37mBOOST[0m program - Basic Operation Of System Test.
+[1m[97mBOOST[0m program - Basic Operation Of System Test.
While BOOST (your puzzle input) is capable of boosting your sensors, for tenuous safety reasons, it
refuses to do so until the computer it runs on passes some checks to demonstrate it is a
-[1m[37mcomplete Intcode computer[0m.
+[1m[97mcomplete Intcode computer[0m.
Your existing Intcode computer is missing one key feature: it needs support for parameters in
-[1m[37mrelative mode[0m.
+[1m[97mrelative mode[0m.
-Parameters in mode 2, [1m[37mrelative mode[0m, behave very similarly to parameters in
-[1m[37mposition mode[0m: the parameter is interpreted as a position. Like position mode,
-parameters in relative mode can be read from or written to.
+Parameters in mode 2, [1m[97mrelative mode[0m, behave very similarly to parameters in [1m[97mposition mode[0m: the
+parameter is interpreted as a position. Like position mode, parameters in relative mode can be read
+from or written to.
The important difference is that relative mode parameters don't count from address 0. Instead, they
-count from a value called the [1m[37mrelative base[0m. The [1m[37mrelative base[0m starts at
-0.
+count from a value called the [1m[97mrelative base[0m. The [1m[97mrelative base[0m starts at 0.
-The address a relative mode parameter refers to is itself [1m[37mplus[0m the current
-[1m[37mrelative base[0m. When the relative base is 0, relative mode parameters and position mode
-parameters with the same value refer to the same address.
+The address a relative mode parameter refers to is itself [1m[97mplus[0m the current [1m[97mrelative base[0m. When the
+relative base is 0, relative mode parameters and position mode parameters with the same value refer
+to the same address.
For example, given a relative base of 50, a relative mode parameter of -7 refers to memory address
-50 + -7 = [1m[37m43[0m.
+50 + -7 = [1m[97m43[0m.
-The relative base is modified with the [1m[37mrelative base offset[0m instruction:
+The relative base is modified with the [1m[97mrelative base offset[0m instruction:
- - Opcode 9 [1m[37madjusts the relative base[0m by the value of its only parameter. The relative
-base increases (or decreases, if the value is negative) by the value of the parameter.
+ - Opcode 9 [1m[97madjusts the relative base[0m by the value of its only parameter. The relative base
+increases (or decreases, if the value is negative) by the value of the parameter.
For example, if the relative base is 2000, then after the instruction 109,19, the relative base
@@ -66,6 +65,6 @@ modes) that seem to be functioning incorrectly, and finally output a BOOST keyco
Once your Intcode computer is fully functional, the BOOST program should report no malfunctioning
opcodes when run in test mode; it should only output a single value, the BOOST keycode.
-[1m[37mWhat BOOST keycode does it produce?[0m
+[1m[97mWhat BOOST keycode does it produce?[0m
diff --git a/09/part2 b/09/part2
@@ -1,16 +1,15 @@
--- Part Two ---
-[1m[37mYou now have a complete Intcode computer.[0m
+[1m[97mYou now have a complete Intcode computer.[0m
Finally, you can lock on to the Ceres distress signal! You just need to boost your sensors using the
BOOST program.
The program runs in sensor boost mode by providing the input instruction the value 2. Once run, it
will boost the sensors automatically, but it might take a few seconds to complete the operation on
-slower hardware. In sensor boost mode, the program will output a single value: [1m[37mthe
-coordinates of the distress signal[0m.
+slower hardware. In sensor boost mode, the program will output a single value: [1m[97mthe coordinates of
+the distress signal[0m.
-Run the BOOST program in sensor boost mode. [1m[37mWhat are the coordinates of the distress
-signal?[0m
+Run the BOOST program in sensor boost mode. [1m[97mWhat are the coordinates of the distress signal?[0m
diff --git a/10/part1 b/10/part1
@@ -12,12 +12,11 @@ position. The asteroids can be described with X,Y coordinates where X is the di
edge and Y is the distance from the top edge (so the top-left corner is 0,0 and the position
immediately to its right is 1,0).
-Your job is to figure out which asteroid would be the best place to build a [1m[37mnew monitoring
-station[0m. A monitoring station can [1m[37mdetect[0m any asteroid to which it has
-[1m[37mdirect line of sight[0m - that is, there cannot be another asteroid [1m[37mexactly[0m
-between them. This line of sight can be at any angle, not just lines aligned to the grid or
-diagonally. The [1m[37mbest[0m location is the asteroid that can [1m[37mdetect[0m the largest
-number of other asteroids.
+Your job is to figure out which asteroid would be the best place to build a [1m[97mnew monitoring
+station[0m. A monitoring station can [1m[97mdetect[0m any asteroid to which it has [1m[97mdirect line of sight[0m - that
+is, there cannot be another asteroid [1m[97mexactly[0m between them. This line of sight can be at any angle,
+not just lines aligned to the grid or diagonally. The [1m[97mbest[0m location is the asteroid that can
+[1m[97mdetect[0m the largest number of other asteroids.
For example, consider the following map:
@@ -25,7 +24,7 @@ For example, consider the following map:
.....
#####
....#
-...[1m[37m#[0m#
+...[1m[97m#[0m#
The best location for a new monitoring station on this map is the highlighted asteroid at 3,4
because it can detect 8 asteroids, more than any other location. (The only asteroid it cannot detect
@@ -67,7 +66,7 @@ Here are some larger examples:
..#....#.#
#..#....#.
.##.#..###
-##...[1m[37m#[0m..#.
+##...[1m[97m#[0m..#.
.#....####
@@ -75,7 +74,7 @@ Here are some larger examples:
#.#...#.#.
.###....#.
-.[1m[37m#[0m....#...
+.[1m[97m#[0m....#...
##.#.#.#.#
....#.#.#.
.##..###.#
@@ -90,7 +89,7 @@ Here are some larger examples:
.#..#..###
####.###.#
....###.#.
-..###.[1m[37m#[0m#.#
+..###.[1m[97m#[0m#.#
##.##.#.#.
....###..#
..#.#..#.#
@@ -114,7 +113,7 @@ Here are some larger examples:
..######..##.#######
####.##.####...##..#
.#####..#.######.###
-##...#.####[1m[37m#[0m#####...
+##...#.####[1m[97m#[0m#####...
#.##########.#######
.####.#.###.###.#.##
....##.##.###..#####
@@ -124,7 +123,7 @@ Here are some larger examples:
-Find the best location for a new monitoring station. [1m[37mHow many other asteroids can be
-detected from that location?[0m
+Find the best location for a new monitoring station. [1m[97mHow many other asteroids can be detected from
+that location?[0m
diff --git a/10/part2 b/10/part2
@@ -3,17 +3,17 @@
Once you give them the coordinates, the Elves quickly deploy an Instant Monitoring Station to the
location and discover the worst: there are simply too many asteroids.
-The only solution is [1m[37mcomplete vaporization by giant laser[0m.
+The only solution is [1m[97mcomplete vaporization by giant laser[0m.
Fortunately, in addition to an asteroid scanner, the new monitoring station also comes equipped with
a giant rotating laser perfect for vaporizing asteroids. The laser starts by pointing
-[1m[37mup[0m and always rotates [1m[37mclockwise[0m, vaporizing any asteroid it hits.
+[1m[97mup[0m and always rotates [1m[97mclockwise[0m, vaporizing any asteroid it hits.
-If multiple asteroids are [1m[37mexactly[0m in line with the station, the laser only has enough
-power to vaporize [1m[37mone[0m of them before continuing its rotation. In other words, the same
-asteroids that can be [1m[37mdetected[0m can be vaporized, but if vaporizing one asteroid makes
-another one detectable, the newly-detected asteroid won't be vaporized until the laser has returned
-to the same position by rotating a full 360 degrees.
+If multiple asteroids are [1m[97mexactly[0m in line with the station, the laser only has enough power to
+vaporize [1m[97mone[0m of them before continuing its rotation. In other words, the same asteroids that can be
+[1m[97mdetected[0m can be vaporized, but if vaporizing one asteroid makes another one detectable, the
+newly-detected asteroid won't be vaporized until the laser has returned to the same position by
+rotating a full 360 degrees.
For example, consider the following map, where the asteroid with the new monitoring station (and
laser) is marked X:
@@ -26,9 +26,9 @@ laser) is marked X:
The first nine asteroids to get vaporized, in order, would be:
-.#....###[1m[37m2[0m[1m[37m4[0m...#..
-##...##.[1m[37m1[0m[1m[37m3[0m#[1m[37m6[0m[1m[37m7[0m..[1m[37m9[0m#
-##...#...[1m[37m5[0m.[1m[37m8[0m####.
+.#....###[1m[97m2[0m[1m[97m4[0m...#..
+##...##.[1m[97m1[0m[1m[97m3[0m#[1m[97m6[0m[1m[97m7[0m..[1m[97m9[0m#
+##...#...[1m[97m5[0m.[1m[97m8[0m####.
..#.....X...###..
..#.#.....#....##
@@ -38,25 +38,25 @@ vaporized are:
.#....###.....#..
##...##...#.....#
-##...#......[1m[37m1[0m[1m[37m2[0m[1m[37m3[0m[1m[37m4[0m.
-..#.....X...[1m[37m5[0m##..
-..#.[1m[37m9[0m.....[1m[37m8[0m....[1m[37m7[0m[1m[37m6[0m
+##...#......[1m[97m1[0m[1m[97m2[0m[1m[97m3[0m[1m[97m4[0m.
+..#.....X...[1m[97m5[0m##..
+..#.[1m[97m9[0m.....[1m[97m8[0m....[1m[97m7[0m[1m[97m6[0m
The next nine to be vaporized are then:
-.[1m[37m8[0m....###.....#..
-[1m[37m5[0m[1m[37m6[0m...[1m[37m9[0m#...#.....#
-[1m[37m3[0m[1m[37m4[0m...[1m[37m7[0m...........
-..[1m[37m2[0m.....X....##..
-..[1m[37m1[0m..............
+.[1m[97m8[0m....###.....#..
+[1m[97m5[0m[1m[97m6[0m...[1m[97m9[0m#...#.....#
+[1m[97m3[0m[1m[97m4[0m...[1m[97m7[0m...........
+..[1m[97m2[0m.....X....##..
+..[1m[97m1[0m..............
Finally, the laser completes its first full rotation (1 through 3), a second rotation (4 through 8),
and vaporizes the last asteroid (9) partway through its third rotation:
-......[1m[37m2[0m[1m[37m3[0m[1m[37m4[0m.....[1m[37m6[0m..
-......[1m[37m1[0m...[1m[37m5[0m.....[1m[37m7[0m
+......[1m[97m2[0m[1m[97m3[0m[1m[97m4[0m.....[1m[97m6[0m..
+......[1m[97m1[0m...[1m[97m5[0m.....[1m[97m7[0m
.................
-........X....[1m[37m8[0m[1m[37m9[0m..
+........X....[1m[97m8[0m[1m[97m9[0m..
.................
In the large example above (the one with the best monitoring station location at 11,13):
@@ -78,15 +78,15 @@ In the large example above (the one with the best monitoring station location at
- The 199th asteroid to be vaporized is at 9,6.
- - [1m[37mThe 200th asteroid to be vaporized is at 8,2.[0m
+ - [1m[97mThe 200th asteroid to be vaporized is at 8,2.[0m
- The 201st asteroid to be vaporized is at 10,9.
- The 299th and final asteroid to be vaporized is at 11,1.
-The Elves are placing bets on which will be the [1m[37m200th[0m asteroid to be vaporized. Win
-the bet by determining which asteroid that will be; [1m[37mwhat do you get if you multiply its X
-coordinate by 100 and then add its Y coordinate?[0m (For example, 8,2 becomes [1m[37m802[0m.)
+The Elves are placing bets on which will be the [1m[97m200th[0m asteroid to be vaporized. Win the bet by
+determining which asteroid that will be; [1m[97mwhat do you get if you multiply its X coordinate by 100 and
+then add its Y coordinate?[0m (For example, 8,2 becomes [1m[97m802[0m.)
diff --git a/11/part1 b/11/part1
@@ -1,39 +1,35 @@
--- Day 11: Space Police ---
-On the way to Jupiter, you're pulled over by the [1m[37mSpace Police[0m.
+On the way to Jupiter, you're pulled over by the [1m[97mSpace Police[0m.
"Attention, unmarked spacecraft! You are in violation of Space Law! All spacecraft must have a
-clearly visible [1m[37mregistration identifier[0m! You have 24 hours to comply or be sent to
-Space Jail!"
+clearly visible [1m[97mregistration identifier[0m! You have 24 hours to comply or be sent to Space Jail!"
Not wanting to be sent to Space Jail, you radio back to the Elves on Earth for help. Although it
takes almost three hours for their reply signal to reach you, they send instructions for how to
-power up the [1m[37memergency hull painting robot[0m and even provide a small Intcode program
-(your puzzle input) that will cause it to paint your ship appropriately.
+power up the [1m[97memergency hull painting robot[0m and even provide a small Intcode program (your puzzle
+input) that will cause it to paint your ship appropriately.
There's just one problem: you don't have an emergency hull painting robot.
You'll need to build a new emergency hull painting robot. The robot needs to be able to move around
on the grid of square panels on the side of your ship, detect the color of its current panel, and
-paint its current panel [1m[37mblack[0m or [1m[37mwhite[0m. (All of the panels are currently
-[1m[37mblack[0m.)
+paint its current panel [1m[97mblack[0m or [1m[97mwhite[0m. (All of the panels are currently [1m[97mblack[0m.)
The Intcode program will serve as the brain of the robot. The program uses input instructions to
-access the robot's camera: provide 0 if the robot is over a [1m[37mblack[0m panel or 1 if the
-robot is over a [1m[37mwhite[0m panel. Then, the program will output two values:
+access the robot's camera: provide 0 if the robot is over a [1m[97mblack[0m panel or 1 if the robot is over a
+[1m[97mwhite[0m panel. Then, the program will output two values:
- - First, it will output a value indicating the [1m[37mcolor to paint the panel[0m the robot is
-over: 0 means to paint the panel [1m[37mblack[0m, and 1 means to paint the panel
-[1m[37mwhite[0m.
+ - First, it will output a value indicating the [1m[97mcolor to paint the panel[0m the robot is over: 0 means
+to paint the panel [1m[97mblack[0m, and 1 means to paint the panel [1m[97mwhite[0m.
- - Second, it will output a value indicating the [1m[37mdirection the robot should turn[0m: 0
-means it should turn [1m[37mleft 90 degrees[0m, and 1 means it should turn [1m[37mright 90
-degrees[0m.
+ - Second, it will output a value indicating the [1m[97mdirection the robot should turn[0m: 0 means it should
+turn [1m[97mleft 90 degrees[0m, and 1 means it should turn [1m[97mright 90 degrees[0m.
-After the robot turns, it should always move [1m[37mforward exactly one panel[0m. The robot
-starts facing [1m[37mup[0m.
+After the robot turns, it should always move [1m[97mforward exactly one panel[0m. The robot starts facing
+[1m[97mup[0m.
The robot will continue running for a while like this and halt when it is finished drawing. Do not
restart the Intcode computer inside the robot during this process.
@@ -86,12 +82,11 @@ should be provided 1. After several more outputs (0,1, 1,0, 1,0), the area look
.....
Before you deploy the robot, you should probably have an estimate of the area it will cover:
-specifically, you need to know the [1m[37mnumber of panels it paints at least once[0m, regardless
-of color. In the example above, the robot painted [1m[37m6 panels[0m at least once. (It painted
-its starting panel twice, but that panel is still only counted once; it also never painted the panel
-it ended on.)
+specifically, you need to know the [1m[97mnumber of panels it paints at least once[0m, regardless of color. In
+the example above, the robot painted [1m[97m6 panels[0m at least once. (It painted its starting panel twice,
+but that panel is still only counted once; it also never painted the panel it ended on.)
-Build a new emergency hull painting robot and run the Intcode program on it. [1m[37mHow many
-panels does it paint at least once?[0m
+Build a new emergency hull painting robot and run the Intcode program on it. [1m[97mHow many panels does it
+paint at least once?[0m
diff --git a/11/part2 b/11/part2
@@ -1,15 +1,14 @@
--- Part Two ---
-You're not sure what it's trying to paint, but it's definitely not a [1m[37mregistration
-identifier[0m. The Space Police are getting impatient.
+You're not sure what it's trying to paint, but it's definitely not a [1m[97mregistration identifier[0m. The
+Space Police are getting impatient.
Checking your external ship cameras again, you notice a white panel marked "emergency hull painting
-robot starting panel". The rest of the panels are [1m[37mstill black[0m, but it looks like the
-robot was expecting to [1m[37mstart on a white panel[0m, not a black one.
+robot starting panel". The rest of the panels are [1m[97mstill black[0m, but it looks like the robot was
+expecting to [1m[97mstart on a white panel[0m, not a black one.
Based on the Space Law Space Brochure that the Space Police attached to one of your windows, a valid
-registration identifier is always [1m[37meight capital letters[0m. After starting the robot on a
-single [1m[37mwhite panel[0m instead, [1m[37mwhat registration identifier does it paint[0m on
-your hull?
+registration identifier is always [1m[97meight capital letters[0m. After starting the robot on a single
+[1m[97mwhite panel[0m instead, [1m[97mwhat registration identifier does it paint[0m on your hull?
diff --git a/12/part1 b/12/part1
@@ -2,31 +2,29 @@
The space near Jupiter is not a very safe place; you need to be careful of a big distracting red
spot, extreme radiation, and a whole lot of moons swirling around. You decide to start by tracking
-the four largest moons: [1m[37mIo[0m, [1m[37mEuropa[0m, [1m[37mGanymede[0m, and
-[1m[37mCallisto[0m.
+the four largest moons: [1m[97mIo[0m, [1m[97mEuropa[0m, [1m[97mGanymede[0m, and [1m[97mCallisto[0m.
-After a brief scan, you calculate the [1m[37mposition of each moon[0m (your puzzle input). You
-just need to [1m[37msimulate their motion[0m so you can avoid them.
+After a brief scan, you calculate the [1m[97mposition of each moon[0m (your puzzle input). You just need to
+[1m[97msimulate their motion[0m so you can avoid them.
Each moon has a 3-dimensional position (x, y, and z) and a 3-dimensional velocity. The position of
each moon is given in your scan; the x, y, and z velocity of each moon starts at 0.
-Simulate the motion of the moons in [1m[37mtime steps[0m. Within each time step, first update the
-velocity of every moon by applying [1m[37mgravity[0m. Then, once all moons' velocities have been
-updated, update the position of every moon by applying [1m[37mvelocity[0m. Time progresses by one
-step once all of the positions are updated.
+Simulate the motion of the moons in [1m[97mtime steps[0m. Within each time step, first update the velocity of
+every moon by applying [1m[97mgravity[0m. Then, once all moons' velocities have been updated, update the
+position of every moon by applying [1m[97mvelocity[0m. Time progresses by one step once all of the positions
+are updated.
-To apply [1m[37mgravity[0m, consider every [1m[37mpair[0m of moons. On each axis (x, y, and
-z), the velocity of each moon changes by [1m[37mexactly +1 or -1[0m to pull the moons together.
-For example, if Ganymede has an x position of 3, and Callisto has a x position of 5, then Ganymede's
-x velocity [1m[37mchanges by +1[0m (because 5 > 3) and Callisto's x velocity [1m[37mchanges by
--1[0m (because 3 < 5). However, if the positions on a given axis are the same, the velocity on that
-axis [1m[37mdoes not change[0m for that pair of moons.
+To apply [1m[97mgravity[0m, consider every [1m[97mpair[0m of moons. On each axis (x, y, and z), the velocity of each
+moon changes by [1m[97mexactly +1 or -1[0m to pull the moons together. For example, if Ganymede has an x
+position of 3, and Callisto has a x position of 5, then Ganymede's x velocity [1m[97mchanges by +1[0m (because
+5 > 3) and Callisto's x velocity [1m[97mchanges by -1[0m (because 3 < 5). However, if the positions on a given
+axis are the same, the velocity on that axis [1m[97mdoes not change[0m for that pair of moons.
-Once all gravity has been applied, apply [1m[37mvelocity[0m: simply add the velocity of each moon
-to its own position. For example, if Europa has a position of x=1, y=2, z=3 and a velocity of x=-2,
-y=0,z=3, then its new position would be x=-1, y=2, z=6. This process does not modify the velocity of
-any moon.
+Once all gravity has been applied, apply [1m[97mvelocity[0m: simply add the velocity of each moon to its own
+position. For example, if Europa has a position of x=1, y=2, z=3 and a velocity of x=-2, y=0,z=3,
+then its new position would be x=-1, y=2, z=6. This process does not modify the velocity of any
+moon.
For example, suppose your scan reveals the following positions:
@@ -103,22 +101,21 @@ pos=<x= 1, y=-8, z= 0>, vel=<x=-1, y= 1, z= 3>
pos=<x= 3, y=-6, z= 1>, vel=<x= 3, y= 2, z=-3>
pos=<x= 2, y= 0, z= 4>, vel=<x= 1, y=-1, z=-1>
-Then, it might help to calculate the [1m[37mtotal energy in the system[0m. The total energy for a
-single moon is its [1m[37mpotential energy[0m multiplied by its [1m[37mkinetic energy[0m. A
-moon's [1m[37mpotential energy[0m is the sum of the absolute values of its x, y, and z position
-coordinates. A moon's [1m[37mkinetic energy[0m is the sum of the absolute values of its velocity
-coordinates. Below, each line shows the calculations for a moon's potential energy (pot), kinetic
-energy (kin), and total energy:
+Then, it might help to calculate the [1m[97mtotal energy in the system[0m. The total energy for a single moon
+is its [1m[97mpotential energy[0m multiplied by its [1m[97mkinetic energy[0m. A moon's [1m[97mpotential energy[0m is the sum of
+the absolute values of its x, y, and z position coordinates. A moon's [1m[97mkinetic energy[0m is the sum of
+the absolute values of its velocity coordinates. Below, each line shows the calculations for a
+moon's potential energy (pot), kinetic energy (kin), and total energy:
Energy after 10 steps:
pot: 2 + 1 + 3 = 6; kin: 3 + 2 + 1 = 6; total: 6 * 6 = 36
pot: 1 + 8 + 0 = 9; kin: 1 + 1 + 3 = 5; total: 9 * 5 = 45
pot: 3 + 6 + 1 = 10; kin: 3 + 2 + 3 = 8; total: 10 * 8 = 80
pot: 2 + 0 + 4 = 6; kin: 1 + 1 + 1 = 3; total: 6 * 3 = 18
-Sum of total energy: 36 + 45 + 80 + 18 = [1m[37m179[0m
+Sum of total energy: 36 + 45 + 80 + 18 = [1m[97m179[0m
In the above example, adding together the total energy for all moons after 10 steps produces the
-total energy in the system, [1m[37m179[0m.
+total energy in the system, [1m[97m179[0m.
Here's a second example:
@@ -200,9 +197,8 @@ pot: 8 + 12 + 9 = 29; kin: 7 + 3 + 0 = 10; total: 29 * 10 = 290
pot: 13 + 16 + 3 = 32; kin: 3 + 11 + 5 = 19; total: 32 * 19 = 608
pot: 29 + 11 + 1 = 41; kin: 3 + 7 + 4 = 14; total: 41 * 14 = 574
pot: 16 + 13 + 23 = 52; kin: 7 + 1 + 1 = 9; total: 52 * 9 = 468
-Sum of total energy: 290 + 608 + 574 + 468 = [1m[37m1940[0m
+Sum of total energy: 290 + 608 + 574 + 468 = [1m[97m1940[0m
-[1m[37mWhat is the total energy in the system[0m after simulating the moons given in your scan
-for 1000 steps?
+[1m[97mWhat is the total energy in the system[0m after simulating the moons given in your scan for 1000 steps?
diff --git a/12/part2 b/12/part2
@@ -3,8 +3,8 @@
All this drifting around in space makes you wonder about the nature of the universe. Does history
really repeat itself? You're curious whether the moons will ever return to a previous state.
-Determine [1m[37mthe number of steps[0m that must occur before all of the moons'
-[1m[37mpositions and velocities[0m exactly match a previous point in time.
+Determine [1m[97mthe number of steps[0m that must occur before all of the moons' [1m[97mpositions and velocities[0m
+exactly match a previous point in time.
For example, the first example above takes 2772 steps before they exactly match a previous point in
time; it eventually returns to the initial state:
@@ -33,8 +33,8 @@ pos=<x= 2, y=-10, z= -7>, vel=<x= 0, y= 0, z= 0>
pos=<x= 4, y= -8, z= 8>, vel=<x= 0, y= 0, z= 0>
pos=<x= 3, y= 5, z= -1>, vel=<x= 0, y= 0, z= 0>
-Of course, the universe might last for a [1m[37mvery long time[0m before repeating. Here's a
-copy of the second example from above:
+Of course, the universe might last for a [1m[97mvery long time[0m before repeating. Here's a copy of the
+second example from above:
<x=-8, y=-10, z=0>
<x=5, y=5, z=10>
@@ -42,9 +42,8 @@ copy of the second example from above:
<x=9, y=-8, z=-3>
This set of initial positions takes 4686774924 steps before it repeats a previous state! Clearly,
-you might need to [1m[37mfind a more efficient way to simulate the universe[0m.
+you might need to [1m[97mfind a more efficient way to simulate the universe[0m.
-[1m[37mHow many steps does it take[0m to reach the first state that exactly matches a previous
-state?
+[1m[97mHow many steps does it take[0m to reach the first state that exactly matches a previous state?
diff --git a/13/part1 b/13/part1
@@ -4,32 +4,31 @@ As you ponder the solitude of space and the ever-increasing three-hour roundtrip
between you and Earth, you notice that the Space Mail Indicator Light is blinking. To help keep you
sane, the Elves have sent you a care package.
-It's a new game for the ship's arcade cabinet! Unfortunately, the arcade is [1m[37mall the way[0m
-on the other end of the ship. Surely, it won't be hard to build your own - the care package even
-comes with schematics.
+It's a new game for the ship's arcade cabinet! Unfortunately, the arcade is [1m[97mall the way[0m on the other
+end of the ship. Surely, it won't be hard to build your own - the care package even comes with
+schematics.
The arcade cabinet runs Intcode software like the game the Elves sent (your puzzle input). It has a
-primitive screen capable of drawing square [1m[37mtiles[0m on a grid. The software draws tiles
-to the screen with output instructions: every three output instructions specify the x position
-(distance from the left), y position (distance from the top), and tile id. The tile id is
-interpreted as follows:
+primitive screen capable of drawing square [1m[97mtiles[0m on a grid. The software draws tiles to the screen
+with output instructions: every three output instructions specify the x position (distance from the
+left), y position (distance from the top), and tile id. The tile id is interpreted as follows:
- - 0 is an [1m[37mempty[0m tile. No game object appears in this tile.
+ - 0 is an [1m[97mempty[0m tile. No game object appears in this tile.
- - 1 is a [1m[37mwall[0m tile. Walls are indestructible barriers.
+ - 1 is a [1m[97mwall[0m tile. Walls are indestructible barriers.
- - 2 is a [1m[37mblock[0m tile. Blocks can be broken by the ball.
+ - 2 is a [1m[97mblock[0m tile. Blocks can be broken by the ball.
- - 3 is a [1m[37mhorizontal paddle[0m tile. The paddle is indestructible.
+ - 3 is a [1m[97mhorizontal paddle[0m tile. The paddle is indestructible.
- - 4 is a [1m[37mball[0m tile. The ball moves diagonally and bounces off objects.
+ - 4 is a [1m[97mball[0m tile. The ball moves diagonally and bounces off objects.
-For example, a sequence of output values like 1,2,3,6,5,4 would draw a [1m[37mhorizontal
-paddle[0m tile (1 tile from the left and 2 tiles from the top) and a [1m[37mball[0m tile (6
-tiles from the left and 5 tiles from the top).
+For example, a sequence of output values like 1,2,3,6,5,4 would draw a [1m[97mhorizontal paddle[0m tile (1
+tile from the left and 2 tiles from the top) and a [1m[97mball[0m tile (6 tiles from the left and 5 tiles from
+the top).
-Start the game. [1m[37mHow many block tiles are on the screen when the game exits?[0m
+Start the game. [1m[97mHow many block tiles are on the screen when the game exits?[0m
diff --git a/13/part2 b/13/part2
@@ -8,11 +8,11 @@ The arcade cabinet has a joystick that can move left and right. The software re
the joystick with input instructions:
- - If the joystick is in the [1m[37mneutral position[0m, provide 0.
+ - If the joystick is in the [1m[97mneutral position[0m, provide 0.
- - If the joystick is [1m[37mtilted to the left[0m, provide -1.
+ - If the joystick is [1m[97mtilted to the left[0m, provide -1.
- - If the joystick is [1m[37mtilted to the right[0m, provide 1.
+ - If the joystick is [1m[97mtilted to the right[0m, provide 1.
The arcade cabinet also has a segment display capable of showing a single number that represents the
@@ -21,7 +21,6 @@ instruction is not a tile; the value instead specifies the new score to show in
For example, a sequence of output values like -1,0,12345 would show 12345 as the player's current
score.
-Beat the game by breaking all the blocks. [1m[37mWhat is your score after the last block is
-broken?[0m
+Beat the game by breaking all the blocks. [1m[97mWhat is your score after the last block is broken?[0m
diff --git a/14/part1 b/14/part1
@@ -1,16 +1,17 @@
--- Day 14: Space Stoichiometry ---
-As you approach the rings of Saturn, your ship's low fuel indicator turns on. There isn't any fuel
+As you approach the rings of Saturn, your ship's [1m[97mlow fuel[0m indicator turns on. There isn't any fuel
here, but the rings have plenty of raw material. Perhaps your ship's Inter-Stellar Refinery Union
-brand nanofactory can turn these raw materials into fuel.
+brand [1m[97mnanofactory[0m can turn these raw materials into fuel.
-You ask the nanofactory to produce a list of the reactions it can perform that are relevant to this
-process (your puzzle input). Every reaction turns some quantities of specific input chemicals into
-some quantity of an output chemical. Almost every chemical is produced by exactly one reaction; the
+You ask the nanofactory to produce a list of the [1m[97mreactions[0m it can perform that are relevant to this
+process (your puzzle input). Every reaction turns some quantities of specific [1m[97minput chemicals[0m into
+some quantity of an [1m[97moutput chemical[0m. Almost every [1m[97mchemical[0m is produced by exactly one reaction; the
only exception, ORE, is the raw material input to the entire process and is not produced by a
reaction.
-You just need to know how much ORE you'll need to collect before you can produce one unit of FUEL.
+You just need to know how much [1m[97mORE[0m you'll need to collect before you can produce one unit of
+[1m[97mFUEL[0m.
Each reaction gives specific quantities for its inputs and output; reactions cannot be partially
run, so only whole integer multiples of these quantities can be used. (It's okay to have leftover
@@ -30,7 +31,7 @@ Suppose your nanofactory produces the following list of reactions:
The first two reactions use only ORE as inputs; they indicate that you can produce as much of
chemical A as you want (in increments of 10 units, each 10 costing 10 ORE) and as much of chemical B
-as you want (each costing 1 ORE). To produce 1 FUEL, a total of 31 ORE is required: 1 ORE to
+as you want (each costing 1 ORE). To produce 1 FUEL, a total of [1m[97m31[0m ORE is required: 1 ORE to
produce 1 B, then 30 more ORE to produce the 7 + 7 + 7 + 7 = 28 A (with 2 extra A wasted) required
in the reactions to convert the B into C, C into D, D into E, and finally E into FUEL. (30 A is
produced because its reaction requires that it is created in increments of 10.)
@@ -45,7 +46,7 @@ Or, suppose you have the following list of reactions:
4 C, 1 A => 1 CA
2 AB, 3 BC, 4 CA => 1 FUEL
-The above list of reactions requires 165 ORE to produce 1 FUEL:
+The above list of reactions requires [1m[97m165[0m ORE to produce 1 FUEL:
- Consume 45 ORE to produce 10 A.
@@ -66,7 +67,7 @@ The above list of reactions requires 165 ORE to produce 1 FUEL:
Here are some larger examples:
- - 13312 ORE for 1 FUEL:
+ - [1m[97m13312[0m ORE for 1 FUEL:
157 ORE => 5 NZVS
165 ORE => 6 DCFZ
@@ -79,7 +80,7 @@ Here are some larger examples:
3 DCFZ, 7 NZVS, 5 HKGWZ, 10 PSHF => 8 KHKGT
- - 180697 ORE for 1 FUEL:
+ - [1m[97m180697[0m ORE for 1 FUEL:
2 VPVL, 7 FWMGM, 2 CXFTF, 11 MNCFX => 1 STKFG
17 NVRVD, 3 JNWZP => 8 VPVL
@@ -95,7 +96,7 @@ Here are some larger examples:
176 ORE => 6 VJHF
- - 2210736 ORE for 1 FUEL:
+ - [1m[97m2210736[0m ORE for 1 FUEL:
171 ORE => 8 CNZTR
7 ZLQW, 3 BMBT, 9 XCVML, 26 XMNCP, 1 WPTQ, 2 MZWV, 1 RJRHP => 4 PLWSL
@@ -117,7 +118,7 @@ Here are some larger examples:
-Given the list of reactions in your puzzle input, what is the minimum amount of ORE required to
-produce exactly 1 FUEL?
+Given the list of reactions in your puzzle input, [1m[97mwhat is the minimum amount of ORE required to
+produce exactly 1 FUEL?[0m
diff --git a/14/part2 b/14/part2
@@ -1,123 +1,18 @@
---- Day 14: Space Stoichiometry ---
+--- Part Two ---
-As you approach the rings of Saturn, your ship's low fuel indicator turns on. There isn't any fuel
-here, but the rings have plenty of raw material. Perhaps your ship's Inter-Stellar Refinery Union
-brand nanofactory can turn these raw materials into fuel.
+After collecting ORE for a while, you check your cargo hold: [1m[97m1 trillion[0m ([1m[97m1000000000000[0m) units of
+ORE.
-You ask the nanofactory to produce a list of the reactions it can perform that are relevant to this
-process (your puzzle input). Every reaction turns some quantities of specific input chemicals into
-some quantity of an output chemical. Almost every chemical is produced by exactly one reaction; the
-only exception, ORE, is the raw material input to the entire process and is not produced by a
-reaction.
+[1m[97mWith that much ore[0m, given the examples above:
-You just need to know how much ORE you'll need to collect before you can produce one unit of FUEL.
-Each reaction gives specific quantities for its inputs and output; reactions cannot be partially
-run, so only whole integer multiples of these quantities can be used. (It's okay to have leftover
-chemicals when you're done, though.) For example, the reaction 1 A, 2 B, 3 C => 2 D means that
-exactly 2 units of chemical D can be produced by consuming exactly 1 A, 2 B and 3 C. You can run
-the full reaction as many times as necessary; for example, you could produce 10 D by consuming 5 A,
-10 B, and 15 C.
+ - The 13312 ORE-per-FUEL example could produce [1m[97m82892753[0m FUEL.
-Suppose your nanofactory produces the following list of reactions:
+ - The 180697 ORE-per-FUEL example could produce [1m[97m5586022[0m FUEL.
-10 ORE => 10 A
-1 ORE => 1 B
-7 A, 1 B => 1 C
-7 A, 1 C => 1 D
-7 A, 1 D => 1 E
-7 A, 1 E => 1 FUEL
+ - The 2210736 ORE-per-FUEL example could produce [1m[97m460664[0m FUEL.
-The first two reactions use only ORE as inputs; they indicate that you can produce as much of
-chemical A as you want (in increments of 10 units, each 10 costing 10 ORE) and as much of chemical B
-as you want (each costing 1 ORE). To produce 1 FUEL, a total of 31 ORE is required: 1 ORE to
-produce 1 B, then 30 more ORE to produce the 7 + 7 + 7 + 7 = 28 A (with 2 extra A wasted) required
-in the reactions to convert the B into C, C into D, D into E, and finally E into FUEL. (30 A is
-produced because its reaction requires that it is created in increments of 10.)
-Or, suppose you have the following list of reactions:
-
-9 ORE => 2 A
-8 ORE => 3 B
-7 ORE => 5 C
-3 A, 4 B => 1 AB
-5 B, 7 C => 1 BC
-4 C, 1 A => 1 CA
-2 AB, 3 BC, 4 CA => 1 FUEL
-
-The above list of reactions requires 165 ORE to produce 1 FUEL:
-
-
- - Consume 45 ORE to produce 10 A.
-
- - Consume 64 ORE to produce 24 B.
-
- - Consume 56 ORE to produce 40 C.
-
- - Consume 6 A, 8 B to produce 2 AB.
-
- - Consume 15 B, 21 C to produce 3 BC.
-
- - Consume 16 C, 4 A to produce 4 CA.
-
- - Consume 2 AB, 3 BC, 4 CA to produce 1 FUEL.
-
-
-Here are some larger examples:
-
-
- - 13312 ORE for 1 FUEL:
-
-157 ORE => 5 NZVS
-165 ORE => 6 DCFZ
-44 XJWVT, 5 KHKGT, 1 QDVJ, 29 NZVS, 9 GPVTF, 48 HKGWZ => 1 FUEL
-12 HKGWZ, 1 GPVTF, 8 PSHF => 9 QDVJ
-179 ORE => 7 PSHF
-177 ORE => 5 HKGWZ
-7 DCFZ, 7 PSHF => 2 XJWVT
-165 ORE => 2 GPVTF
-3 DCFZ, 7 NZVS, 5 HKGWZ, 10 PSHF => 8 KHKGT
-
-
- - 180697 ORE for 1 FUEL:
-
-2 VPVL, 7 FWMGM, 2 CXFTF, 11 MNCFX => 1 STKFG
-17 NVRVD, 3 JNWZP => 8 VPVL
-53 STKFG, 6 MNCFX, 46 VJHF, 81 HVMC, 68 CXFTF, 25 GNMV => 1 FUEL
-22 VJHF, 37 MNCFX => 5 FWMGM
-139 ORE => 4 NVRVD
-144 ORE => 7 JNWZP
-5 MNCFX, 7 RFSQX, 2 FWMGM, 2 VPVL, 19 CXFTF => 3 HVMC
-5 VJHF, 7 MNCFX, 9 VPVL, 37 CXFTF => 6 GNMV
-145 ORE => 6 MNCFX
-1 NVRVD => 8 CXFTF
-1 VJHF, 6 MNCFX => 4 RFSQX
-176 ORE => 6 VJHF
-
-
- - 2210736 ORE for 1 FUEL:
-
-171 ORE => 8 CNZTR
-7 ZLQW, 3 BMBT, 9 XCVML, 26 XMNCP, 1 WPTQ, 2 MZWV, 1 RJRHP => 4 PLWSL
-114 ORE => 4 BHXH
-14 VRPVC => 6 BMBT
-6 BHXH, 18 KTJDG, 12 WPTQ, 7 PLWSL, 31 FHTLT, 37 ZDVW => 1 FUEL
-6 WPTQ, 2 BMBT, 8 ZLQW, 18 KTJDG, 1 XMNCP, 6 MZWV, 1 RJRHP => 6 FHTLT
-15 XDBXC, 2 LTCX, 1 VRPVC => 6 ZLQW
-13 WPTQ, 10 LTCX, 3 RJRHP, 14 XMNCP, 2 MZWV, 1 ZLQW => 1 ZDVW
-5 BMBT => 4 WPTQ
-189 ORE => 9 KTJDG
-1 MZWV, 17 XDBXC, 3 XCVML => 2 XMNCP
-12 VRPVC, 27 CNZTR => 2 XDBXC
-15 KTJDG, 12 BHXH => 5 XCVML
-3 BHXH, 2 VRPVC => 7 MZWV
-121 ORE => 7 VRPVC
-7 XCVML => 6 RJRHP
-5 BHXH, 4 VRPVC => 5 LTCX
-
-
-
-Given the list of reactions in your puzzle input, what is the minimum amount of ORE required to
-produce exactly 1 FUEL?
+Given 1 trillion ORE, [1m[97mwhat is the maximum amount of FUEL you can produce?[0m
diff --git a/15/part1 b/15/part1
@@ -6,7 +6,7 @@ failed!
According to the readouts, the oxygen system must have failed days ago after a rupture in oxygen
tank two; that section of the ship was automatically sealed once oxygen levels went dangerously low.
-A single remotely-operated repair droid is your only option for fixing the oxygen system.
+A single remotely-operated [1m[97mrepair droid[0m is your only option for fixing the oxygen system.
The Elves' care package included an Intcode program (your puzzle input) that you can use to remotely
control the repair droid. By running that program, you can direct the repair droid to the oxygen
@@ -15,21 +15,21 @@ system and fix the problem.
The remote control program executes the following steps in a loop forever:
- - Accept a movement command via an input instruction.
+ - Accept a [1m[97mmovement command[0m via an input instruction.
- Send the movement command to the repair droid.
- Wait for the repair droid to finish the movement operation.
- - Report on the status of the repair droid via an output instruction.
+ - Report on the [1m[97mstatus[0m of the repair droid via an output instruction.
-Only four movement commands are understood: north (1), south (2), west (3), and east (4). Any other
+Only four [1m[97mmovement commands[0m are understood: north (1), south (2), west (3), and east (4). Any other
command is invalid. The movements differ in direction, but not in distance: in a long enough
east-west hallway, a series of commands like 4,4,4,4,3,3,3,3 would leave the repair droid back where
it started.
-The repair droid can reply with any of the following status codes:
+The repair droid can reply with any of the following [1m[97mstatus[0m codes:
- 0: The repair droid hit a wall. Its position has not changed.
@@ -95,10 +95,10 @@ of 0, and then west (3) gets a reply of 2:
D.#
#
-Now, because of the reply of 2, you know you've found the oxygen system! In this example, it was
-only 2 moves away from the repair droid's starting position.
+Now, because of the reply of 2, you know you've found the [1m[97moxygen system[0m! In this example, it was
+only [1m[97m2[0m moves away from the repair droid's starting position.
-What is the fewest number of movement commands required to move the repair droid from its starting
+[1m[97mWhat is the fewest number of movement commands[0m required to move the repair droid from its starting
position to the location of the oxygen system?
diff --git a/15/part2 b/15/part2
@@ -2,9 +2,9 @@
You quickly repair the oxygen system; oxygen gradually fills the area.
-Oxygen starts in the location containing the repaired oxygen system. It takes one minute for oxygen
+Oxygen starts in the location containing the repaired oxygen system. It takes [1m[97mone minute[0m for oxygen
to spread to all open locations that are adjacent to a location that already contains oxygen.
-Diagonal locations are not adjacent.
+Diagonal locations are [1m[97mnot[0m adjacent.
In the example above, suppose you've used the droid to explore the area fully and have the following
map (where locations that currently contain oxygen are marked O):
@@ -49,9 +49,9 @@ And finally, the whole region is full of oxygen after a total of four minutes:
#OOO#
###
-So, in this example, all locations contain oxygen after 4 minutes.
+So, in this example, all locations contain oxygen after [1m[97m4[0m minutes.
-Use the repair droid to get a complete map of the area. How many minutes will it take to fill with
-oxygen?
+Use the repair droid to get a complete map of the area. [1m[97mHow many minutes will it take to fill with
+oxygen?[0m
diff --git a/16/part1 b/16/part1
@@ -2,24 +2,24 @@
You're 3/4ths of the way through the gas giants. Not only do roundtrip signals to Earth take five
hours, but the signal quality is quite bad as well. You can clean up the signal with the Flawed
-Frequency Transmission algorithm, or FFT.
+Frequency Transmission algorithm, or [1m[97mFFT[0m.
As input, FFT takes a list of numbers. In the signal you received (your puzzle input), each number
is a single digit: data like 15243 represents the sequence 1, 5, 2, 4, 3.
-FFT operates in repeated phases. In each phase, a new list is constructed with the same length as
+FFT operates in repeated [1m[97mphases[0m. In each phase, a new list is constructed with the same length as
the input list. This new list is also used as the input for the next phase.
Each element in the new list is built by multiplying every value in the input list by a value in a
-repeating pattern and then adding up the results. So, if the input list were 9, 8, 7, 6, 5 and the
+repeating [1m[97mpattern[0m and then adding up the results. So, if the input list were 9, 8, 7, 6, 5 and the
pattern for a given element were 1, 2, 3, the result would be 9*1 + 8*2 + 7*3 + 6*1 + 5*2 (with each
input element on the left and each value in the repeating pattern on the right of each
multiplication). Then, only the ones digit is kept: 38 becomes 8, -17 becomes 7, and so on.
While each element in the output array uses all of the same input array elements, the actual
-repeating pattern to use depends on which output element is being calculated. The base pattern is 0,
-1, 0, -1. Then, repeat each value in the pattern a number of times equal to the position in the
-output list being considered. Repeat once for the first element, twice for the second element, three
+repeating pattern to use depends on [1m[97mwhich output element[0m is being calculated. The base pattern is 0,
+1, 0, -1. Then, repeat each value in the pattern a number of times equal to the [1m[97mposition in the
+output list[0m being considered. Repeat once for the first element, twice for the second element, three
times for the third element, and so on. So, if the third element of the output list is being
calculated, repeating the values would produce: 0, 0, 0, 1, 1, 1, 0, 0, 0, -1, -1, -1.
@@ -90,6 +90,6 @@ Here are the first eight digits of the final output list after 100 phases for so
- 69317163492948606335995924319873 becomes 52432133.
-After 100 phases of FFT, what are the first eight digits in the final output list?
+After [1m[97m100[0m phases of FFT, [1m[97mwhat are the first eight digits in the final output list?[0m
diff --git a/16/part2 b/16/part2
@@ -1,13 +1,13 @@
--- Part Two ---
-Now that your FFT is working, you can decode the real signal.
+Now that your FFT is working, you can decode the [1m[97mreal signal[0m.
-The real signal is your puzzle input repeated 10000 times. Treat this new signal as a single input
+The real signal is your puzzle input [1m[97mrepeated 10000 times[0m. Treat this new signal as a single input
list. Patterns are still calculated as before, and 100 phases of FFT are still applied.
-The first seven digits of your initial input signal also represent the message offset. The message
+The [1m[97mfirst seven digits[0m of your initial input signal also represent the [1m[97mmessage offset[0m. The message
offset is the location of the eight-digit message in the final output list. Specifically, the
-message offset indicates the number of digits to skip before reading the eight-digit message. For
+message offset indicates [1m[97mthe number of digits to skip[0m before reading the eight-digit message. For
example, if the first seven digits of your initial input signal were 1234567, the eight-digit
message would be the eight digits after skipping 1,234,567 digits of the final output list. Or, if
the message offset were 7 and your final output list were 98765432109876543210, the eight-digit
@@ -19,14 +19,14 @@ in each input has been highlighted. (Note that the inputs given below are repeat
find the actual starting input lists.)
- - 03036732577212944063491565474664 becomes 84462026.
+ - [1m[97m0303673[0m2577212944063491565474664 becomes 84462026.
- - 02935109699940807407585447034323 becomes 78725270.
+ - [1m[97m0293510[0m9699940807407585447034323 becomes 78725270.
- - 03081770884921959731165446850517 becomes 53553731.
+ - [1m[97m0308177[0m0884921959731165446850517 becomes 53553731.
-After repeating your input signal 10000 times and running 100 phases of FFT, what is the eight-digit
-message embedded in the final output list?
+After repeating your input signal 10000 times and running 100 phases of FFT, [1m[97mwhat is the eight-digit
+message embedded in the final output list?[0m
diff --git a/17/part1 b/17/part1
@@ -9,7 +9,7 @@ The only tools at your disposal are some wired cameras and a small vacuum robot
its charging station. The video quality is poor, but the vacuum robot has a needlessly bright LED
that makes it easy to spot no matter where it is.
-An Intcode program, the Aft Scaffolding Control and Information Interface (ASCII, your puzzle
+An Intcode program, the [1m[97mAft Scaffolding Control and Information Interface[0m (ASCII, your puzzle
input), provides access to the cameras and the vacuum robot. Currently, because the vacuum robot is
asleep, you can only access the cameras.
@@ -19,8 +19,8 @@ of output below the current one, and so on. (Within a line, characters are drawn
In the camera output, # represents a scaffold and . represents open space. The vacuum robot is
visible as ^, v, <, or > depending on whether it is facing up, down, left, or right respectively.
-When drawn like this, the vacuum robot is always on a scaffold; if the vacuum robot ever walks off
-of a scaffold and begins tumbling through space uncontrollably, it will instead be visible as X.
+When drawn like this, the vacuum robot is [1m[97malways on a scaffold[0m; if the vacuum robot ever walks off
+of a scaffold and begins [1m[97mtumbling through space uncontrollably[0m, it will instead be visible as X.
In general, the scaffold forms a path, but it sometimes loops back onto itself. For example,
suppose you can see the following view from the cameras:
@@ -37,8 +37,8 @@ Here, the vacuum robot, ^ is facing up and sitting at one end of the scaffold ne
of the image. The scaffold continues up, loops across itself several times, and ends at the top-left
of the image.
-The first step is to calibrate the cameras by getting the alignment parameters of some well-defined
-points. Locate all scaffold intersections; for each, its alignment parameter is the distance
+The first step is to calibrate the cameras by getting the [1m[97malignment parameters[0m of some well-defined
+points. Locate all [1m[97mscaffold intersections[0m; for each, its alignment parameter is the distance
between its left edge and the left edge of the view multiplied by the distance between its top edge
and the top edge of the view. Here, the intersections from the above image are marked O:
@@ -54,20 +54,20 @@ For these intersections:
- The top-left intersection is 2 units from the left of the image and 2 units from the top of the
-image, so its alignment parameter is 2 * 2 = 4.
+image, so its alignment parameter is 2 * 2 = [1m[97m4[0m.
- The bottom-left intersection is 2 units from the left and 4 units from the top, so its alignment
-parameter is 2 * 4 = 8.
+parameter is 2 * 4 = [1m[97m8[0m.
- The bottom-middle intersection is 6 from the left and 4 from the top, so its alignment parameter
-is 24.
+is [1m[97m24[0m.
- - The bottom-right intersection's alignment parameter is 40.
+ - The bottom-right intersection's alignment parameter is [1m[97m40[0m.
-To calibrate the cameras, you need the sum of the alignment parameters. In the above example, this
-is 76.
+To calibrate the cameras, you need the [1m[97msum of the alignment parameters[0m. In the above example, this
+is [1m[97m76[0m.
-Run your ASCII program. What is the sum of the alignment parameters for the scaffold intersections?
+Run your ASCII program. [1m[97mWhat is the sum of the alignment parameters[0m for the scaffold intersections?
diff --git a/17/part2 b/17/part2
@@ -2,36 +2,36 @@
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 visit every part
-of the scaffold at least once.
+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
-override its movement logic with new rules.
+[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
-2. When you do this, you will be automatically prompted for the new movement rules that the vacuum
+[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 main movement routine. The main routine may only call the
-movement functions: A, B, or C. Supply the movement functions to use as ASCII text, separating them
+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 movement function. Movement functions may use L to turn left, R
-to turn right, or a number to move forward 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
+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 continuous video feed; provide either y or n
+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 at most 20 characters, not counting the newline.
+and the movement functions may each contain [1m[97mat most 20 characters[0m, not counting the newline.
For example, consider the following camera feed:
@@ -51,7 +51,7 @@ For example, consider the following camera feed:
....#...#......
....#####......
-In order for the vacuum robot to visit every part of the scaffold at least once, one path it could
+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
@@ -61,13 +61,13 @@ routine call A once. However, you'll need to split it into smaller parts.
One approach is:
- - Main routine: A,B,C,B,A,C(ASCII input: 65, 44, 66, 44, 67, 44, 66, 44, 65, 44, 67, 10)
+ - [1m[97mMain routine: A,B,C,B,A,C[0m(ASCII input: 65, 44, 66, 44, 67, 44, 66, 44, 65, 44, 67, 10)
- - Function A: R,8,R,8(ASCII input: 82, 44, 56, 44, 82, 44, 56, 10)
+ - [1m[97mFunction A: R,8,R,8[0m(ASCII input: 82, 44, 56, 44, 82, 44, 56, 10)
- - Function B: R,4,R,4,R,8(ASCII input: 82, 44, 52, 44, 82, 44, 52, 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)
- - Function C: L,6,L,2(ASCII input: 76, 44, 54, 44, 76, 44, 50, 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:
@@ -99,7 +99,7 @@ programmed set of movements, assuming it hasn't drifted off into space, the clea
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, how much dust does the vacuum robot report
-it has collected?
+After visiting every part of the scaffold at least once, [1m[97mhow much dust does the vacuum robot report
+it has collected?[0m
diff --git a/18/part1 b/18/part1
@@ -6,11 +6,11 @@ on Triton! You have no choice but to land.
A scan of the local area reveals only one interesting feature: a massive underground vault. You
generate a map of the tunnels (your puzzle input). The tunnels are too narrow to move diagonally.
-Only one entrance (marked @) is present among the open passages (marked .) and stone walls (#), but
-you also detect an assortment of keys (shown as lowercase letters) and doors (shown as uppercase
+Only one [1m[97mentrance[0m (marked @) is present among the [1m[97mopen passages[0m (marked .) and [1m[97mstone walls[0m (#), but
+you also detect an assortment of [1m[97mkeys[0m (shown as lowercase letters) and [1m[97mdoors[0m (shown as uppercase
letters). Keys of a given letter open the door of the same letter: a opens A, b opens B, and so on.
-You aren't sure which key you need to disable the tractor beam, so you'll need to collect all of
-them.
+You aren't sure which key you need to disable the tractor beam, so you'll need to [1m[97mcollect all of
+them[0m.
For example, suppose you have the following map:
@@ -31,7 +31,7 @@ Then, you can move 6 steps to collect the only other key, b:
#@......#
#########
-So, collecting every key took a total of 8 steps.
+So, collecting every key took a total of [1m[97m8[0m steps.
Here is a larger example:
@@ -74,7 +74,7 @@ slower in the long run than collecting key d first, so that's the best choice:
#@.....................#
########################
-Finally, collect key e to unlock door E, then collect key f, taking a grand total of 86 steps.
+Finally, collect key e to unlock door E, then collect key f, taking a grand total of [1m[97m86[0m steps.
Here are a few more examples:
@@ -112,6 +112,6 @@ Shortest paths are 81 steps; one is: a, c, f, i, d, g, b, e, h
-How many steps is the shortest path that collects all of the keys?
+[1m[97mHow many steps is the shortest path that collects all of the keys?[0m
diff --git a/18/part2 b/18/part2
@@ -1,6 +1,6 @@
--- Part Two ---
-You arrive at the vault only to discover that there is not one vault, but four - each with its own
+You arrive at the vault only to discover that there is not one vault, but [1m[97mfour[0m - each with its own
entrance.
On your map, find the area in the middle that looks like this:
@@ -19,9 +19,9 @@ This change will split your map into four separate sections, each with its own e
####### #######
#a.#Cd# #a.#Cd#
-##...## ##@#@##
-##.@.## --> #######
-##...## ##@#@##
+##...## ##[1m[97m@#@[0m##
+##.@.## --> ##[1m[97m###[0m##
+##...## ##[1m[97m@#@[0m##
#cB#Ab# #cB#Ab#
####### #######
@@ -29,7 +29,7 @@ Because some of the keys are for doors in other vaults, it would take much too l
of the keys by yourself. Instead, you deploy four remote-controlled robots. Each starts at one of
the entrances (@).
-Your goal is still to collect all of the keys in the fewest steps, but now, each robot has its own
+Your goal is still to [1m[97mcollect all of the keys in the fewest steps[0m, but now, each robot has its own
position and can move independently. You can only remotely control a single robot at a time.
Collecting a key instantly unlocks any corresponding doors, regardless of the vault in which the key
or door is found.
@@ -75,7 +75,7 @@ Finally, the top-right robot collects key d:
#@.#.@#
#######
-In this example, it only took 8 steps to collect all of the keys.
+In this example, it only took [1m[97m8[0m steps to collect all of the keys.
Sometimes, multiple robots might have keys available, or a robot might have to wait for multiple
keys to be collected:
@@ -90,7 +90,7 @@ keys to be collected:
First, the top-right, bottom-left, and bottom-right robots take turns collecting keys a, b, and c, a
total of 6 + 6 + 6 = 18 steps. Then, the top-left robot can access key d, spending another 6 steps;
-collecting all of the keys here takes a minimum of 24 steps.
+collecting all of the keys here takes a minimum of [1m[97m24[0m steps.
Here's a more complex example:
@@ -128,7 +128,7 @@ Here's a more complex example:
- Top-right robot collects key l.
-In the above example, the fewest steps to collect all of the keys is 32.
+In the above example, the fewest steps to collect all of the keys is [1m[97m32[0m.
Here's an example with more choices:
@@ -176,9 +176,9 @@ One solution with the fewest steps is:
- Bottom-left robot collects key o.
-This example requires at least 72 steps to collect all keys.
+This example requires at least [1m[97m72[0m steps to collect all keys.
-After updating your map and using the remote-controlled robots, what is the fewest steps necessary
-to collect all of the keys?
+After updating your map and using the remote-controlled robots, [1m[97mwhat is the fewest steps necessary
+to collect all of the keys?[0m
diff --git a/19/part1 b/19/part1
@@ -9,15 +9,15 @@ drone system can be configured to deploy a drone to specific coordinates and the
being pulled. There's even an Intcode program (your puzzle input) that gives you access to the drone
system.
-The program uses two input instructions to request the X and Y position to which the drone should be
-deployed. Negative numbers are invalid and will confuse the drone; all numbers should be zero or
-positive.
+The program uses two input instructions to request the [1m[97mX and Y position[0m to which the drone should be
+deployed. Negative numbers are invalid and will confuse the drone; all numbers should be
+[1m[97mzero or positive[0m.
-Then, the program will output whether the drone is stationary (0) or being pulled by something (1).
+Then, the program will output whether the drone is [1m[97mstationary[0m (0) or [1m[97mbeing pulled by something[0m (1).
For example, the coordinate X=0, Y=0 is directly in front of the tractor beam emitter, so the drone
control program will always report 1 at that location.
-To better understand the tractor beam, it is important to get a good picture of the beam itself. For
+To better understand the tractor beam, it is important to [1m[97mget a good picture[0m of the beam itself. For
example, suppose you scan the 10x10 grid of points closest to the emitter:
X
@@ -33,11 +33,11 @@ Y .....####.
.......###
9........##
-In this example, the number of points affected by the tractor beam in the 10x10 area closest to the
-emitter is 27.
+In this example, the [1m[97mnumber of points affected by the tractor beam[0m in the 10x10 area closest to the
+emitter is [1m[97m27[0m.
-However, you'll need to scan a larger area to understand the shape of the beam. How many points are
-affected by the tractor beam in the 50x50 area closest to the emitter? (For each of X and Y, this
+However, you'll need to scan a larger area to [1m[97munderstand the shape[0m of the beam. [1m[97mHow many points are
+affected by the tractor beam in the 50x50 area closest to the emitter?[0m (For each of X and Y, this
will be 0 through 49.)
diff --git a/19/part2 b/19/part2
@@ -1,8 +1,8 @@
--- Part Two ---
You aren't sure how large Santa's ship is. You aren't even sure if you'll need to use this thing on
-Santa's ship, but it doesn't hurt to be prepared. You figure Santa's ship might fit in a 100x100
-square.
+Santa's ship, but it doesn't hurt to be prepared. You figure Santa's ship might fit in a
+[1m[97m100x100[0m square.
The beam gets wider as it travels away from the emitter; you'll need to be a minimum distance away
to fit a square of that size into the beam fully. (Don't rotate the square; it should be aligned to
@@ -30,7 +30,7 @@ For example, suppose you have the following tractor beam readings:
...............###############..........
................###############.........
................#################.......
-.................########OOOOOOOOOO.....
+.................########[1m[97mO[0mOOOOOOOOO.....
..................#######OOOOOOOOOO#....
...................######OOOOOOOOOO###..
....................#####OOOOOOOOOO#####
@@ -46,13 +46,13 @@ For example, suppose you have the following tractor beam readings:
............................############
.............................###########
-In this example, the 10x10 square closest to the emitter that fits entirely within the tractor beam
-has been marked O. Within it, the point closest to the emitter (the only highlighted O) is at X=25,
+In this example, the [1m[97m10x10[0m square closest to the emitter that fits entirely within the tractor beam
+has been marked O. Within it, the point closest to the emitter (the only highlighted [1m[97mO[0m) is at X=25,
Y=20.
-Find the 100x100 square closest to the emitter that fits entirely within the tractor beam; within
-that square, find the point closest to the emitter. What value do you get if you take that point's
-X coordinate, multiply it by 10000, then add the point's Y coordinate? (In the example above, this
+Find the [1m[97m100x100[0m square closest to the emitter that fits entirely within the tractor beam; within
+that square, find the point closest to the emitter. [1m[97mWhat value do you get if you take that point's
+X coordinate, multiply it by 10000, then add the point's Y coordinate?[0m (In the example above, this
would be 250020.)
diff --git a/20/part1 b/20/part1
@@ -43,7 +43,7 @@ One path through the maze doesn't require any portals. Starting at AA, you coul
However, there is a shorter path: You could walk from AA to the inner BC portal (4 steps), warp to
the outer BC portal (1 step), walk to the inner DE (6 steps), warp to the outer DE (1 step), walk to
the outer FG (4 steps), warp to the inner FG (1 step), and finally walk to ZZ (6 steps). In total,
-this is only 23 steps.
+this is only [1m[97m23[0m steps.
Here is a larger example:
@@ -86,9 +86,9 @@ YN......# VT..#....QG
U P P
Here, AA has no direct path to ZZ, but it does connect to AS and CP. By passing through AS, QG, BU,
-and JO, you can reach ZZ in 58 steps.
+and JO, you can reach ZZ in [1m[97m58[0m steps.
-In your maze, how many steps does it take to get from the open tile marked AA to the open tile
-marked ZZ?
+In your maze, [1m[97mhow many steps does it take to get from the open tile marked AA to the open tile
+marked ZZ?[0m
diff --git a/20/part2 b/20/part2
@@ -1,12 +1,12 @@
--- Part Two ---
Strangely, the exit isn't open when you reach it. Then, you remember: the ancient Plutonians were
-famous for building recursive spaces.
+famous for building [1m[97mrecursive spaces[0m.
-The marked connections in the maze aren't portals: they physically connect to a larger or smaller
+The marked connections in the maze aren't portals: they [1m[97mphysically connect[0m to a larger or smaller
copy of the maze. Specifically, the labeled tiles around the inside edge actually connect to a
-smaller copy of the same maze, and the smaller copy's inner labeled tiles connect to yet a smaller
-copy, and so on.
+smaller copy of the same maze, and the smaller copy's inner labeled tiles connect to yet a
+[1m[97msmaller[0m copy, and so on.
When you enter the maze, you are at the outermost level; when at the outermost level, only the outer
labels AA and ZZ function (as the start and end, respectively); all other outer labeled tiles are
@@ -198,10 +198,10 @@ One shortest path through the maze is the following:
- Walk from FD to ZZ (18 steps)
-This path takes a total of 396 steps to move from AA at the outermost layer to ZZ at the outermost
+This path takes a total of [1m[97m396[0m steps to move from AA at the outermost layer to ZZ at the outermost
layer.
-In your maze, when accounting for recursion, how many steps does it take to get from the open tile
-marked AA to the open tile marked ZZ, both at the outermost layer?
+In your maze, when accounting for recursion, [1m[97mhow many steps does it take to get from the open tile
+marked AA to the open tile marked ZZ, both at the outermost layer?[0m
diff --git a/21/part1 b/21/part1
@@ -9,42 +9,43 @@ violently.
You can send a droid out to investigate, but the tumbling is causing enough artificial gravity that
one wrong step could send the droid through a hole in the hull and flying out into space.
-The clear choice for this mission is a droid that can jump over the holes in the hull - a
-springdroid.
+The clear choice for this mission is a droid that can [1m[97mjump[0m over the holes in the hull - a
+[1m[97mspringdroid[0m.
You can use an Intcode program (your puzzle input) running on an ASCII-capable computer to program
the springdroid. However, springdroids don't run Intcode; instead, they run a simplified assembly
-language called springscript.
+language called [1m[97mspringscript[0m.
While a springdroid is certainly capable of navigating the artificial gravity and giant holes, it
-has one downside: it can only remember at most 15 springscript instructions.
+has one downside: it can only remember at most [1m[97m15[0m springscript instructions.
-The springdroid will move forward automatically, constantly thinking about whether to jump. The
+The springdroid will move forward automatically, constantly thinking about [1m[97mwhether to jump[0m. The
springscript program defines the logic for this decision.
Springscript programs only use Boolean values, not numbers or strings. Two registers are available:
-T, the temporary value register, and J, the jump register. If the jump register is true at the end
-of the springscript program, the springdroid will try to jump. Both of these registers start with
-the value false.
+T, the [1m[97mtemporary value[0m register, and J, the [1m[97mjump[0m register. If the jump register is
+[1m[97mtrue[0m at the end of the springscript program, the springdroid will try to jump. Both of these
+registers start with the value [1m[97mfalse[0m.
-Springdroids have a sensor that can detect whether there is ground at various distances in the
-direction it is facing; these values are provided in read-only registers. Your springdroid can
+Springdroids have a sensor that can detect [1m[97mwhether there is ground[0m at various distances in the
+direction it is facing; these values are provided in [1m[97mread-only registers[0m. Your springdroid can
detect ground at four distances: one tile away (A), two tiles away (B), three tiles away (C), and
-four tiles away (D). If there is ground at the given distance, the register will be true; if there
-is a hole, the register will be false.
+four tiles away (D). If there is ground at the given distance, the register will be
+[1m[97mtrue[0m; if there is a hole, the register will be [1m[97mfalse[0m.
-There are only three instructions available in springscript:
+There are only [1m[97mthree instructions[0m available in springscript:
- - AND X Y sets Y to true if both X and Y are true; otherwise, it sets Y to false.
+ - AND X Y sets Y to [1m[97mtrue[0m if both X and Y are [1m[97mtrue[0m; otherwise, it sets Y to [1m[97mfalse[0m.
- - OR X Y sets Y to true if at least one of X or Y is true; otherwise, it sets Y to false.
+ - OR X Y sets Y to [1m[97mtrue[0m if at least one of X or Y is [1m[97mtrue[0m; otherwise, it sets Y to
+[1m[97mfalse[0m.
- - NOT X Y sets Y to true if X is false; otherwise, it sets Y to false.
+ - NOT X Y sets Y to [1m[97mtrue[0m if X is [1m[97mfalse[0m; otherwise, it sets Y to [1m[97mfalse[0m.
-In all three instructions, the second argument (Y) needs to be a writable register (either T or J).
-The first argument (X) can be any register (including A, B, C, or D).
+In all three instructions, the second argument (Y) needs to be a [1m[97mwritable register[0m (either T or J).
+The first argument (X) can be [1m[97many register[0m (including A, B, C, or D).
For example, the one-instruction program NOT A J means "if the tile immediately in front of me is
not ground, jump".
@@ -60,59 +61,59 @@ AND T J
AND D J
The Intcode program expects ASCII inputs and outputs. It will begin by displaying a prompt; then,
-input the desired instructions one per line. End each line with a newline (ASCII code 10). When you
-have finished entering your program, provide the command WALK followed by a newline to instruct the
-springdroid to begin surveying the hull.
+input the desired instructions one per line. End each line with a newline (ASCII code 10).
+[1m[97mWhen you have finished entering your program[0m, provide the command WALK followed by a newline to
+instruct the springdroid to begin surveying the hull.
-If the springdroid falls into space, an ASCII rendering of the last moments of its life will be
+If the springdroid [1m[97mfalls into space[0m, an ASCII rendering of the last moments of its life will be
produced. In these, @ is the springdroid, # is hull, and . is empty space. For example, suppose
you program the springdroid like this:
NOT D J
WALK
-This one-instruction program sets J to true if and only if there is no ground four tiles away. In
+This one-instruction program sets J to [1m[97mtrue[0m if and only if there is no ground four tiles away. In
other words, it attempts to jump into any hole it finds:
.................
.................
-@................
+[1m[97m@[0m................
#####.###########
.................
.................
-.@...............
+.[1m[97m@[0m...............
#####.###########
.................
-..@..............
+..[1m[97m@[0m..............
.................
#####.###########
-...@.............
+...[1m[97m@[0m.............
.................
.................
#####.###########
.................
-....@............
+....[1m[97m@[0m............
.................
#####.###########
.................
.................
-.....@...........
+.....[1m[97m@[0m...........
#####.###########
.................
.................
.................
-#####@###########
+#####[1m[97m@[0m###########
However, if the springdroid successfully makes it across, it will use an output instruction to
-indicate the amount of damage to the hull as a single giant integer outside the normal ASCII range.
+indicate the [1m[97mamount of damage to the hull[0m as a single giant integer outside the normal ASCII range.
Program the springdroid with logic that allows it to survey the hull without falling into space.
-What amount of hull damage does it report?
+[1m[97mWhat amount of hull damage does it report?[0m
diff --git a/21/part2 b/21/part2
@@ -1,27 +1,27 @@
--- Part Two ---
There are many areas the springdroid can't reach. You flip through the manual and discover a way to
-increase its sensor range.
+[1m[97mincrease its sensor range[0m.
-Instead of ending your springcode program with WALK, use RUN. Doing this will enable extended sensor
-mode, capable of sensing ground up to nine tiles away. This data is available in five new read-only
-registers:
+Instead of ending your springcode program with WALK, use RUN. Doing this will enable
+[1m[97mextended sensor mode[0m, capable of sensing ground up to [1m[97mnine tiles away[0m. This data is available in
+[1m[97mfive new read-only registers[0m:
- - Register E indicates whether there is ground five tiles away.
+ - Register E indicates whether there is ground [1m[97mfive[0m tiles away.
- - Register F indicates whether there is ground six tiles away.
+ - Register F indicates whether there is ground [1m[97msix[0m tiles away.
- - Register G indicates whether there is ground seven tiles away.
+ - Register G indicates whether there is ground [1m[97mseven[0m tiles away.
- - Register H indicates whether there is ground eight tiles away.
+ - Register H indicates whether there is ground [1m[97meight[0m tiles away.
- - Register I indicates whether there is ground nine tiles away.
+ - Register I indicates whether there is ground [1m[97mnine[0m tiles away.
All other functions remain the same.
-Successfully survey the rest of the hull by ending your program with RUN. What amount of hull
-damage does the springdroid now report?
+Successfully survey the rest of the hull by ending your program with RUN. [1m[97mWhat amount of hull
+damage does the springdroid now report?[0m
diff --git a/22/part1 b/22/part1
@@ -3,15 +3,15 @@
There isn't much to do while you wait for the droids to repair your ship. At least you're drifting
in the right direction. You decide to practice a new card shuffle you've been working on.
-Digging through the ship's storage, you find a deck of space cards! Just like any deck of space
+Digging through the ship's storage, you find a deck of [1m[97mspace cards[0m! Just like any deck of space
cards, there are 10007 cards in the deck numbered 0 through 10006. The deck must be new - they're
-still in factory order, with 0 on the top, then 1, then 2, and so on, all the way through to 10006
+still in [1m[97mfactory order[0m, with 0 on the top, then 1, then 2, and so on, all the way through to 10006
on the bottom.
-You've been practicing three different techniques that you use while shuffling. Suppose you have a
+You've been practicing three different [1m[97mtechniques[0m that you use while shuffling. Suppose you have a
deck of only 10 cards (numbered 0 through 9):
-To deal into new stack, create a new stack of cards by dealing the top card of the deck onto the top
+[1m[97mTo deal into new stack[0m, create a new stack of cards by dealing the top card of the deck onto the top
of the new stack repeatedly until you run out of cards:
Top Bottom
@@ -37,7 +37,7 @@ Several steps later...
Finally, pick up the new stack you've just created and use it as the deck for the next technique.
-To cut N cards, take the top N cards off the top of the deck and move them as a single unit to the
+[1m[97mTo cut N cards[0m, take the top N cards off the top of the deck and move them as a single unit to the
bottom of the deck, retaining their order. For example, to cut 3:
Top Bottom
@@ -66,7 +66,7 @@ Top Bottom
6 7 8 9 0 1 2 3 4 5 Your deck
-To deal with increment N, start by clearing enough space on your table to lay out all of the cards
+[1m[97mTo deal with increment N[0m, start by clearing enough space on your table to lay out all of the cards
individually in a long line. Deal the top card into the leftmost position. Then, move N positions
to the right and deal the next card there. If you would move into a position past the end of the
space on your table, wrap around and keep counting from the leftmost card again. Continue this
@@ -128,7 +128,7 @@ the card to its right ends up just below the top card, and so on, until the righ
at the bottom of the deck.
The complete shuffle process (your puzzle input) consists of applying many of these techniques.
-Here are some examples that combine techniques; they all start with a factory order deck of 10
+Here are some examples that combine techniques; they all start with a [1m[97mfactory order[0m deck of 10
cards:
deal with increment 7
@@ -161,6 +161,6 @@ Result: 9 2 5 8 1 4 7 0 3 6
Positions within the deck count from 0 at the top, then 1 for the card immediately below the top
card, and so on to the bottom. (That is, cards start in the position matching their number.)
-After shuffling your factory order deck of 10007 cards, what is the position of card 2019?
+After shuffling your [1m[97mfactory order[0m deck of 10007 cards, [1m[97mwhat is the position of card 2019?[0m
diff --git a/22/part2 b/22/part2
@@ -6,17 +6,17 @@ repairs. While reviewing the work the droids have finished so far, you think yo
fly past!
When you get back, you discover that the 3D printers have combined their power to create for you a
-single, giant, brand new, factory order deck of 119315717514047 space cards.
+single, giant, brand new, [1m[97mfactory order[0m deck of [1m[97m119315717514047 space cards[0m.
Finally, a deck of cards worthy of shuffling!
-You decide to apply your complete shuffle process (your puzzle input) to the deck 101741582076661
-times in a row.
+You decide to apply your complete shuffle process (your puzzle input) to the deck
+[1m[97m101741582076661 times in a row[0m.
-You'll need to be careful, though - one wrong move with this many cards and you might overflow your
-entire ship!
+You'll need to be careful, though - one wrong move with this many cards and you might
+[1m[97moverflow[0m your entire ship!
-After shuffling your new, giant, factory order deck that many times, what number is on the card that
-ends up in position 2020?
+After shuffling your new, giant, [1m[97mfactory order[0m deck that many times, [1m[97mwhat number is on the card that
+ends up in position 2020?[0m
diff --git a/23/part1 b/23/part1
@@ -1,28 +1,28 @@
--- Day 23: Category Six ---
The droids have finished repairing as much of the ship as they can. Their report indicates that
-this was a Category 6 disaster - not because it was that bad, but because it destroyed the stockpile
+this was a [1m[97mCategory 6[0m disaster - not because it was that bad, but because it destroyed the stockpile
of Category 6 network cables as well as most of the ship's network infrastructure.
-You'll need to rebuild the network from scratch.
+You'll need to [1m[97mrebuild the network from scratch[0m.
-The computers on the network are standard Intcode computers that communicate by sending packets to
-each other. There are 50 of them in total, each running a copy of the same Network Interface
-Controller (NIC) software (your puzzle input). The computers have network addresses 0 through 49;
-when each computer boots up, it will request its network address via a single input instruction. Be
-sure to give each computer a unique network address.
+The computers on the network are standard Intcode computers that communicate by sending
+[1m[97mpackets[0m to each other. There are 50 of them in total, each running a copy of the same
+[1m[97mNetwork Interface Controller[0m (NIC) software (your puzzle input). The computers have [1m[97mnetwork
+addresses[0m 0 through 49; when each computer boots up, it will request its network address via a
+single input instruction. Be sure to give each computer a unique network address.
Once a computer has received its network address, it will begin doing work and communicating over
-the network by sending and receiving packets. All packets contain two values named X and Y. Packets
+the network by sending and receiving [1m[97mpackets[0m. All packets contain [1m[97mtwo values[0m named X and Y. Packets
sent to a computer are queued by the recipient and read in the order they are received.
-To send a packet to another computer, the NIC will use three output instructions that provide the
-destination address of the packet followed by its X and Y values. For example, three output
+To [1m[97msend[0m a packet to another computer, the NIC will use [1m[97mthree output instructions[0m that provide the
+[1m[97mdestination address[0m of the packet followed by its X and Y values. For example, three output
instructions that provide the values 10, 20, 30 would send a packet with X=20 and Y=30 to the
computer with address 10.
-To receive a packet from another computer, the NIC will use an input instruction. If the incoming
-packet queue is empty, provide -1. Otherwise, provide the X value of the next packet; the computer
+To [1m[97mreceive[0m a packet from another computer, the NIC will use an [1m[97minput instruction[0m. If the incoming
+packet queue is [1m[97mempty[0m, provide -1. Otherwise, provide the X value of the next packet; the computer
will then use a second input instruction to receive the Y value for the same packet. Once both
values of the packet are read in this way, the packet is removed from the queue.
@@ -31,7 +31,7 @@ wait for the sent packet to be received - the computer might send multiple packe
any. Similarly, input instructions do not wait for a packet to arrive - if no packet is waiting,
input instructions should receive -1.
-Boot up all 50 computers and attach them to your network. What is the Y value of the first packet
-sent to address 255?
+Boot up all 50 computers and attach them to your network. [1m[97mWhat is the Y value of the first packet
+sent to address 255?[0m
diff --git a/23/part2 b/23/part2
@@ -5,18 +5,18 @@ is responsible for managing power consumption of the network by blocking certain
watching for idle periods in the computers.
If a packet would be sent to address 255, the NAT receives it instead. The NAT remembers only the
-last packet it receives; that is, the data in each packet it receives overwrites the NAT's packet
+[1m[97mlast[0m packet it receives; that is, the data in each packet it receives overwrites the NAT's packet
memory with the new packet's X and Y values.
-The NAT also monitors all computers on the network. If all computers have empty incoming packet
-queues and are continuously trying to receive packets without sending packets, the network is
-considered idle.
+The NAT also monitors all computers on the network. If all computers have [1m[97mempty incoming packet
+queues[0m and are [1m[97mcontinuously trying to receive packets[0m without sending packets, the network is
+considered [1m[97midle[0m.
-Once the network is idle, the NAT sends only the last packet it received to address 0; this will
+Once the network is idle, the NAT sends [1m[97monly the last packet it received[0m to address 0; this will
cause the computers on the network to resume activity. In this way, the NAT can throttle power
consumption of the network when the ship needs power in other areas.
-Monitor packets released to the computer at address 0 by the NAT. What is the first Y value
-delivered by the NAT to the computer at address 0 twice in a row?
+Monitor packets released to the computer at address 0 by the NAT. [1m[97mWhat is the first Y value
+delivered by the NAT to the computer at address 0 twice in a row?[0m
diff --git a/24/part1 b/24/part1
@@ -5,19 +5,19 @@ picking up strange life forms moving around: Eris is infested with bugs! With an
roundtrip for messages between you and Earth, you'll have to deal with this problem on your own.
Eris isn't a very large place; a scan of the entire area fits into a 5x5 grid (your puzzle input).
-The scan shows bugs (#) and empty spaces (.).
+The scan shows [1m[97mbugs[0m (#) and [1m[97mempty spaces[0m (.).
-Each minute, The bugs live and die based on the number of bugs in the four adjacent tiles:
+Each [1m[97mminute[0m, The bugs live and die based on the number of bugs in the [1m[97mfour adjacent tiles[0m:
- - A bug dies (becoming an empty space) unless there is exactly one bug adjacent to it.
+ - A bug [1m[97mdies[0m (becoming an empty space) unless there is [1m[97mexactly one[0m bug adjacent to it.
- - An empty space becomes infested with a bug if exactly one or two bugs are adjacent to it.
+ - An empty space [1m[97mbecomes infested[0m with a bug if [1m[97mexactly one or two[0m bugs are adjacent to it.
Otherwise, a bug or empty space remains the same. (Tiles on the edges of the grid have fewer than
four adjacent tiles; the missing tiles count as empty space.) This process happens in every location
-simultaneously; that is, within the same minute, the number of adjacent bugs is counted for every
+[1m[97msimultaneously[0m; that is, within the same minute, the number of adjacent bugs is counted for every
tile first, and then the tiles are updated.
Here are the first few minutes of an example scenario:
@@ -58,7 +58,7 @@ After 4 minutes:
##...
To understand the nature of the bugs, watch for the first time a layout of bugs and empty spaces
-matches any previous layout. In the example above, the first layout to appear twice is:
+[1m[97mmatches any previous layout[0m. In the example above, the first layout to appear twice is:
.....
.....
@@ -66,12 +66,12 @@ matches any previous layout. In the example above, the first layout to appear tw
#....
.#...
-To calculate the biodiversity rating for this layout, consider each tile left-to-right in the top
+To calculate the [1m[97mbiodiversity rating[0m for this layout, consider each tile left-to-right in the top
row, then left-to-right in the second row, and so on. Each of these tiles is worth biodiversity
-points equal to increasing powers of two: 1, 2, 4, 8, 16, 32, and so on. Add up the biodiversity
+points equal to [1m[97mincreasing powers of two[0m: 1, 2, 4, 8, 16, 32, and so on. Add up the biodiversity
points for tiles with bugs; in this example, the 16th tile (32768 points) and 22nd tile (2097152
-points) have bugs, a total biodiversity rating of 2129920.
+points) have bugs, a total biodiversity rating of [1m[97m2129920[0m.
-What is the biodiversity rating for the first layout that appears twice?
+[1m[97mWhat is the biodiversity rating for the first layout that appears twice?[0m
diff --git a/24/part2 b/24/part2
@@ -1,11 +1,12 @@
--- Part Two ---
-After careful analysis, one thing is certain: you have no idea where all these bugs are coming from.
+After careful analysis, one thing is certain: [1m[97myou have no idea where all these bugs are coming
+from[0m.
Then, you remember: Eris is an old Plutonian settlement! Clearly, the bugs are coming from
recursively-folded space.
-This 5x5 grid is only one level in an infinite number of recursion levels. The tile in the middle of
+This 5x5 grid is [1m[97monly one[0m level in an [1m[97minfinite[0m number of recursion levels. The tile in the middle of
the grid is actually another 5x5 grid, the grid in your scan is contained as the middle tile of a
larger 5x5 grid, and so on. Two levels of grids look like this:
@@ -40,11 +41,11 @@ the infinitely recursive grid; there is a 5x5 grid that contains this diagram, a
contains that one, and so on. Also, the ? in the diagram contains another 5x5 grid, which itself
contains another 5x5 grid, and so on.
-The scan you took (your puzzle input) shows where the bugs are on a single level of this structure.
+The scan you took (your puzzle input) shows where the bugs are [1m[97mon a single level[0m of this structure.
The middle tile of your scan is empty to accommodate the recursive grids within it. Initially, no
other levels contain bugs.
-Tiles still count as adjacent if they are directly up, down, left, or right of a given tile. Some
+Tiles still count as [1m[97madjacent[0m if they are directly [1m[97mup, down, left, or right[0m of a given tile. Some
tiles have adjacent tiles at a recursion level above or below its own level. For example:
| | | |
@@ -82,9 +83,9 @@ tiles have adjacent tiles at a recursion level above or below its own level. For
- Tile E has four adjacent tiles: 8, D, 14, and J.
- - Tile 14 has eight adjacent tiles: 9, E, J, O, T, Y, 15, and 19.
+ - Tile 14 has [1m[97meight[0m adjacent tiles: 9, E, J, O, T, Y, 15, and 19.
- - Tile N has eight adjacent tiles: I, O, S, and five tiles within the sub-grid marked ?.
+ - Tile N has [1m[97meight[0m adjacent tiles: I, O, S, and five tiles within the sub-grid marked ?.
The rules about bugs living and dying are the same as before.
@@ -98,8 +99,8 @@ For example, consider the same initial state as above:
#....
The center tile is drawn as ? to indicate the next recursive grid. Call this level 0; the grid
-within this one is level 1, and the grid that contains this one is level -1. Then, after ten
-minutes, the grid at each level would look like this:
+within this one is level 1, and the grid that contains this one is level -1. Then, after
+[1m[97mten[0m minutes, the grid at each level would look like this:
Depth -5:
..#..
@@ -178,8 +179,8 @@ Depth 5:
####.
.....
-In this example, after 10 minutes, a total of 99 bugs are present.
+In this example, after 10 minutes, a total of [1m[97m99[0m bugs are present.
-Starting with your scan, how many bugs are present after 200 minutes?
+Starting with your scan, [1m[97mhow many bugs are present after 200 minutes?[0m
diff --git a/25/main.c b/25/main.c
@@ -522,6 +522,12 @@ exit:
}
hmap_deinit(&map);
+ for (HMAP_ITER(&states, &iter)) {
+ free(iter.link->key._p);
+ free(iter.link->value._p);
+ }
+ hmap_deinit(&states);
+
for (DVEC_ITER(&items, name))
free(*name);
dvec_deinit(&items);
diff --git a/25/part1 b/25/part1
@@ -19,25 +19,25 @@ Command?, you can give it a single instruction terminated with a newline (ASCII
instructions are:
- - Movement via north, south, east, or west.
+ - [1m[97mMovement[0m via north, south, east, or west.
- - To take an item the droid sees in the environment, use the command take <name of item>. For
+ - To [1m[97mtake[0m an item the droid sees in the environment, use the command take <name of item>. For
example, if the droid reports seeing a red ball, you can pick it up with take red ball.
- - To drop an item the droid is carrying, use the command drop <name of item>. For example, if the
+ - To [1m[97mdrop[0m an item the droid is carrying, use the command drop <name of item>. For example, if the
droid is carrying a green ball, you can drop it with drop green ball.
- - To get a list of all of the items the droid is currently carrying, use the command inv (for
+ - To get a [1m[97mlist of all of the items[0m the droid is currently carrying, use the command inv (for
"inventory").
Extra spaces or other characters aren't allowed - instructions must be provided precisely.
-Santa's ship is a Reindeer-class starship; these ships use pressure-sensitive floors to determine
+Santa's ship is a [1m[97mReindeer-class starship[0m; these ships use pressure-sensitive floors to determine
the identity of droids and crew members. The standard configuration for these starships is for all
droids to weigh exactly the same amount to make them easier to detect. If you need to get past such
a sensor, you might be able to reach the correct weight by carrying items from the environment.
-Look around the ship and see if you can find the password for the main airlock.
+Look around the ship and see if you can find the [1m[97mpassword for the main airlock[0m.
diff --git a/25/part2 b/25/part2
@@ -5,7 +5,7 @@ levels. Santa explains that he didn't notice you coming because he was just tak
The ship wasn't frozen; he just had the thermostat set to "North Pole".
You make your way over to the navigation console. It beeps. "Status: Stranded. Please supply
-measurements from 49 stars to recalibrate."
+measurements from [1m[33m49 stars[0m to recalibrate."
"49 stars? But the Elves told me you needed fifty--"
diff --git a/common/aoc.h b/common/aoc.h
@@ -13,7 +13,8 @@ struct aoc {
char *input;
size_t input_size;
- const char **args;
+ int argc;
+ const char **argv;
};
extern struct aoc aoc;
diff --git a/common/main.c b/common/main.c
@@ -17,7 +17,8 @@ main(int argc, const char **argv)
}
aoc.part = atoi(argv[1]);
- aoc.args = &argv[2];
+ aoc.argc = argc - 2;
+ aoc.argv = &argv[2];
envvar = getenv("AOC_DEBUG");
aoc.debug = envvar ? atoi(envvar) : 0;
diff --git a/lib/libpq b/lib/libpq
@@ -1 +0,0 @@
-Subproject commit 46465417e54567584f6d26c157e7ae345e01088e