This repo contains code solutions for the Advent of Code challenges, with detailed challenge descriptions and step-by-step solution details, including code snippets and tests.
Most part of the solutions are implemented using Rust, as it's the language I'm currently studying. Rust is a language created to be fast while also providing a safe runtime. These premises are accomplished by providing a strong compile-time analysis together with a strong type system and some low-level details. Its built-in package manager and build tool, Cargo, provides all the basic tooling needed to easily get the ball rolling.
Some solutions are implemented using Javascript as a fallback for times when I didn't manage to get a solution working with Rust. These JS solutions will be ported to Rust whenever I have some time.
This monorepo is structured to hold all the code for all days of the advent of code. Each directory starting with day-
is a cargo-generated Rust project containing all the details about the challenge for that day and also all the code implemented to solve it. The file tree looks like this:
├── README.md
├── day-01
│ ├── Cargo.lock
│ ├── Cargo.toml
│ ├── README.md
│ ├── input.txt
│ ├── sample.txt
│ └── src
│ ├── lib.rs
│ └── main.rs
.
. ... day 02 to day n-1
.
└── day-n
├── Cargo.lock
├── Cargo.toml
├── README.md
├── input.txt
├── sample.txt
└── src
├── lib.rs
└── main.rs
Each day-n
project look similar, containing:
- Cargo related config files
- a
README.md
with the challenge URL, description and collapsable solution blocks (with "See solution" as its title) - a
sample.txt
file, containing the example described in the challenge - a
input.txt
file, containing the actual input provided by the challenge - a
src/lib.rs
file, containing the actual implementation and tests - a
src/main.rs
file, containing the code that loads the input data, parses it and calls the implementation
The table below contains the solutions for all challenges solved so far.
day | title | implementation | part I | part II |
---|---|---|---|---|
#1 | Calorie counting | here | ✅ | ✅ |
#2 | Rock, paper, scissors | here | ✅ | ✅ |
#3 | Rucksack Reorganization | here | ✅ | ✅ |
#4 | Camp Cleanup | here | ✅ | ✅ |
#5 | Supply Stacks | here | 🚧 | 🚧 |
#6 | Tuning Trouble | here | 🚧 | 🚧 |
#7 | No Space Left On Device | here | 🚧 | 🚧 |
#8 | Treetop Tree House | here | 🚧 | 🚧 |
#9 | Rope Bridge | here | 🚧 | 🚧 |
#10 | Cathode-Ray Tube | here | 🚧 | 🚧 |
#11 | Monkey in the Middle | here | 🚧 | 🚧 |
#12 | Hill Climbing Algorithm | here | 🚧 | 🚧 |
#13 | Distress Signal | here | 🚧 | 🚧 |
#14 | Regolith Reservoir | here | 🚧 | 🚧 |
#15 | Beacon Exclusion Zone | here | 🚧 | ❌ |
#16 | Proboscidea Volcanium | here | ❌ | ❌ |
#17 | Pyroclastic Flow | here | ❌ | ❌ |
#18 | Boiling Boulders | here | 🚧 | ❌ |
#19 | Not Enough Minerals | here | ❌ | ❌ |
#20 | Grove Positioning System | here | ❌ | ❌ |
#21 | Monkey Math | here | ❌ | ❌ |
#22 | Monkey Map | here | ❌ | ❌ |
#23 | Unstable Diffusion | here | ❌ | ❌ |
#24 | Blizzard Basin | here | ❌ | ❌ |
#25 | Full of Hot Air | here | ❌ | ❌ |
- ✅ = solved and documented
- 🚧 = solved, but without documentation
- ❌ = Not solved yet