Advent of Code 2024 - In Rust

After my recent adventures learning Rust, I decided to follow Advent of Code 2024 in Rust.

It was my first AoC and I came for the puzzles and learning, not for the leaderboard. I’ll chip away at the puzzles at my leisure, in the occasional evening here or a weekend there. This article covers days 1 through 5. I’ll publish later articles as I solve more puzzles (or never, if I decide to pursue an actual project instead or life happens).

My goal here is to share a bit about the challenges I encountered and any insights (or lack thereof) I had on the puzzles and on doing them in Rust. I don’t plan to publish the full source code, so I won’t spoil the fun of figuring things out yourself, but I maybe having some notes on problems I encountered helps someone if they are stuck.

Before we dive in, let me compliment Eric and the AoC team on AoC. It’s clear that a lot of thought has gone into the puzzles, but I also dig the charming story and the fantastic “ASCII with sparkles” presentation.

Advent of Code 2024 - In Rust - Days 6-10

This is the second article in a series covering Advent of Code 2024 in Rust. Day 6 – Guard Gallivant This puzzle asks to trace the path taken by a “guard” in a simple grid with obstacles. In the first part of the puzzle, the guard simply turns right at every obstacle and the goal is count the number of fields covered until they exit the grid. I built some basic data structures to represent the grid with marked fields, the guard with a position and direction, and I then implemented the prescribed logic, marking fields as the guard moves.

Advent of Code 2024 - In Rust - Days 1-5

Day 1 – Historian Hysteria The first puzzle aks to compute a few things on two lists of numbers, including their pairwise distance and multiplying numbers by their frequency in the second list. Not much to see here, the main effort went into creating some basic outline of Rust crate with per-day modules and parsing the input. The actual solutions were mainly done with sorting/mapping and creating a frequency map for the second part.