Skip to content

Commit

Permalink
fix link
Browse files Browse the repository at this point in the history
  • Loading branch information
SethTisue committed Jan 2, 2025
1 parent b576834 commit 861b8ff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/2024/puzzles/day17.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ object Day17:
```

Now, let’s implement the `step` method. This is also a relatively straightforward translation from the puzzle description:
* The only case in which the machine halts is if the instruction pointer goes out of bounds, so we start with `program.lift(ip)` (opcode) and `program.lift(ip + 1)` (operand) to wrap the rest of the logic (see my [Day 15 write-up](/scala-advent-of-code/2024/puzzles/day15) if you want a little explanation about `lift`).
* The only case in which the machine halts is if the instruction pointer goes out of bounds, so we start with `program.lift(ip)` (opcode) and `program.lift(ip + 1)` (operand) to wrap the rest of the logic (see my [Day 15 write-up](day15) if you want a little explanation about `lift`).
* We pattern match on the opcode to implement the instructions, observing that for most instructions, the program doesn’t produce any output, and increments `ip` by 2. Also, `combo` is an obvious helper method to write.
* The `adv`, `bdv`, and `cdv` instructions are specified in a kind of roundabout way in the puzzle: they’re just computing a right shift! It took me embarassingly long to realize this.

Expand Down

0 comments on commit 861b8ff

Please sign in to comment.