AoC 2024 Day 23: LAN Partinator

Source: Day 23: LAN Party

Full solution for today (spoilers!).

Part 1

You are given the edges of an undirected graph. Count how many complete subgraphs of size three exist that contain one or more starting with the letter t.

Aside: Games with local (but not hotseat) multiplayer have gotten rather rarer over the years… how many people still know what a LAN party is/was?

read more...


AoC 2024 Day 21: Busy Workinator

Source: Day 21: Keypad Conundrum

Full solution for today (spoilers!).

Part 1

You are trying to type a code on a keypad:

+---+---+---+
| 7 | 8 | 9 |
+---+---+---+
| 4 | 5 | 6 |
+---+---+---+
| 1 | 2 | 3 |
+---+---+---+
    | 0 | A |
    +---+---+

But you cannot type directly. Instead, you can control a pointer on the keypad with arrow keys:

    +---+---+
    | ^ | A |
+---+---+---+
| < | v | > |
+---+---+---+

Whenever you type a ^ on the arrow keys, the pointer on the keypad will move up one, etc. When you type A, then the pointer on the keypad will type whatever it is pointing at.

But that’s not enough either. Add a second keypad. And then a third, that is the one you are actually controlling.

For each output sequence multiple the length of the minimum input sequence needed to generate it by the numeric value of the input sequence (ignoring any A); sum these.

Note: Moving off any keypad or into the blank spaces is an error.

read more...


AoC 2024 Day 17: Virtual Machininator

Source: Day 17: Chronospatial Computer

Full solution for today (spoilers!).

Part 1

Implement a virtual machine. The machine will have 3 unbounded signed registers, 8 opcodes (see below), a variable parameter scheme (see below that). You will be given the initial values of the 3 registers and a program. Find the final output.

Instructions

OpcodeInstructionDescriptionNotes
0adv reg/valA = A >> OP
1bxl valB = B ^ OP
2bst reg/valB = OP & 0b111
3jnz valIf a =/= 0, jump to LIT
4bxc ignoreB = B ^ CStill takes param, but ignores it
5out reg/valOutput bOnly outputs lowest 3 bits
6bdv reg/valB = A >> OPSame as adv but writes to b
7cdv reg/valC = A >> OPSame as adv but writes to c

Parameter specification

For instructions that can take reg/val, 0 to 3 (inclusive) are treated as literal values, 4 is register A, 5 is B, 6, is C, and 7 is an error (should never happen).

For instructions that only take val, it’s always a literal value in the range 0 to 7 (inclusive).

read more...


AoC 2024 Day 11: Exponential Growthinator

Source: Day 11: Plutonian Pebbles

Full solution for today (spoilers!).

Part 1

Given a sequence of values v_n, replace each value with the first matching rule:

  • if v = 0 -> 1
  • If v has an even number of digits, split it (so v = 8675 becomes [86, 75])
  • Otherwise, v -> v * 2024

Calculate how many elements are in the sequence after 25 iterations.

read more...