Log in to get your input and submit your answers.

Day 08: Boot Sequence

Panic is spreading across the cluster: the iMacs won't boot! The screen flashes an Apple logo for a few seconds before shutting down and looping endlessly.

You hook your laptop up to one of the Macs via a serial cable and manage to extract the boot sequence (your puzzle input). The code is written in an assembly dialect that vaguely resembles Corewar.

The processor executes one instruction per line. There are three types of instructions:

Part 1

The issue is glaring: the program is stuck in an infinite loop. It never reaches the end of the file and just keeps running the same sequence of instructions over and over.

Example

Consider this small test program:

nop +0
acc +1
jmp +4
acc +3
jmp -3
acc -99
acc +1
jmp -4
acc +6

Here is how it executes, step by step:

Right before the program runs line 2 for the second time, the accumulator was 5.

Run your own boot sequence through a simulator. What is the value of the accumulator immediately before any instruction is executed a second time?