Advent of Code - Day 5: Cafeteria

2025-12-05.png

As the forklifts break through the wall, the Elves are delighted to discover that there was a cafeteria on the other side after all.

-- Day 5 - Advent of Code 2025

Solution in Java

Full source can be found: in GitHub

Day 5 revolves around interpreting ranges of ingredient IDs and determining which IDs are considered fresh. The input is split into two logical sections: a list of inclusive ID ranges, followed by a list of individual ingredient IDs. Part one asks us to validate the individual IDs against the ranges, while part two focuses entirely on the ranges themselves.

[Read More]

Advent of Code - Day 4: Printing Department

2025-12-04.png

You ride the escalator down to the printing department. They’re clearly getting ready for Christmas; they have lots of large rolls of paper everywhere, and there’s even a massive printer in the corner (to handle the really big print jobs).

-- Day 4 - Advent of Code 2025

Solution in Java

Full source can be found: in GitHub

Day 4 of the Advent-style assignment takes us deep into the North Pole’s printing department. The challenge revolves around a grid filled with paper rolls, represented by @, and empty spaces, represented by .. Forklifts can only access certain rolls based on how crowded their surroundings are, and our job is to identify those rolls and then simulate their removal.

[Read More]

Advent of Code - Day 3: Lobby

2025-12-03.png

You descend a short staircase, enter the surprisingly vast lobby, and are quickly cleared by the security checkpoint. When you get to the main elevators, however, you discover that each one has a red light above it: they’re all offline.

“Sorry about that,” an Elf apologizes as she tinkers with a nearby control panel. “Some kind of electrical surge seems to have fried them. I’ll try to get them online soon.”

[Read More]

Advent of Code - Day 2: Gift Shop

2025-12-02.png

You get inside and take the elevator to its only other stop: the gift shop. “Thank you for visiting the North Pole!” gleefully exclaims a nearby sign. You aren’t sure who is even allowed to visit the North Pole, but you know you can access the lobby through here, and from there you can access the rest of the North Pole base.

-- Day 2 - Advent of Code 2025

[Read More]

Advent of Code - Day 1: Secret Entrance

2025-12-01.png

You arrive at the secret entrance to the North Pole base ready to start decorating. Unfortunately, the password seems to have been changed, so you can’t get in. A document taped to the wall helpfully explains:

“Due to new security protocols, the password is locked in the safe below. Please see the attached document for the new combination.”

-- Day 1 - Advent of Code 2025

Full source can be found: in GitHub

[Read More]

Advent of Code - Day 20: Race Condition

2024-12-20-generated.png

The Historians are quite pixelated again. This time, a massive, black building looms over you - you’re right outside the CPU!

While The Historians get to work, a nearby program sees that you’re idle and challenges you to a race. Apparently, you’ve arrived just in time for the frequently-held race condition festival!

-- Day 20 - Advent of Code 2024

Solution in Java

Full source can be found: in GitHub

Part 1

To represent each point in the grid of the assignment I created the GridPlace class. Which contains the value of the character in the grid as well as the distance from the start (as computed by the path taken).

[Read More]

Advent of Code - Day 19: Linen Layout

2024-12-19-generated.png

Today, The Historians take you up to the hot springs on Gear Island! Very suspiciously, absolutely nothing goes wrong as they begin their careful search of the vast field of helixes.

-- Day 19 - Advent of Code 2024

Solution in Java

Full source can be found: in GitHub

Part 1

The solution for part 1 today can be resolved by creating a regular expression of all allowed rugs (line 16) and then checking each line in the input to see if it matches.

[Read More]

Advent of Code - Day 18: RAM Run

2024-12-18-generated.png

You and The Historians look a lot more pixelated than you remember. You’re inside a computer at the North Pole!

-- Day 18 - Advent of Code 2024

Solution in Java

Full source can be found: in GitHub

Today the assignment involves yet another grid and pathfinding algorithm. So to read the input into memory I created this small method.

1public void readInput() {  
2    grid = new CharGrid(71, 71);
3    inputLoader.splitOnNewLine()  
4            .map(Point::of)  
5            .limit(1024)                        // limit of bytes to fall part1  
6            .forEach(point -> grid.set(point, '#'));  
7}

Part 1

Since the best solution is using the Dijkstra pathfinding algorithm I created a HistorianStep implementation of the Node<T> that is required by the algorithm.

[Read More]

Advent of Code - Day 17: Chronospatial Computer

2024-12-17-generated.png

The Historians push the button on their strange device, but this time, you all just feel like you’re falling.

-- Day 17 - Advent of Code 2024

Solution in Java

Full source can be found: in GitHub

Part 1

The first thing for today is modelling Opcode and the ComputeEngine. Where the compute engine represents the machine that is executing the instruction in the input string.

 1enum Opcode {  
 2    adv, bxl, bst, jnz, bxc, out, bdv, cdv  
 3}
 4
 5public static class ComputeEngine {  
 6    private final long[] registers;  
 7  
 8    int[] program;  
 9    int instructionPointer;  
10  
11    List<Integer> output = new ArrayList<>();  
12  
13    public ComputeEngine(long[] registers, int[] program) {  
14        this.registers = registers;  
15        this.program = program;  
16        this.instructionPointer = 0;  
17    }
18}

Using these two entities it is already possible to create the method that converts the input string.

[Read More]

Advent of Code - Day 16: Reindeer Maze

2024-12-16-generated.png

It’s time again for the Reindeer Olympics! This year, the big event is the Reindeer Maze, where the Reindeer compete for the lowest score.

-- Day 16 - Advent of Code 2024

Solution in Java

Full source can be found: in GitHub

Part 1

Since the problem statement clearly indicates that a path solving algorithm would be best suited I decided to re-use the existing Dijkstra implementation. To use it I added the Step class which implements the Node<T> used by the algorithm.

[Read More]