This repo is built to host my solutions to advent of code puzzles. All days are written in Rust.
Generally speaking, I'm trying to stick to standard library. This is a learning exercise for me & I don't want an external crate to magically do all the work for me. I do make an exception for itertools, is which is de facto part of the standard library as far as I'm concerned. On odd days I'll use other crates too, e.g. the MD-5 crate for 2015/day_04.
I only started in 2021 and did my first year in Python, because I didn't know any better! In fairness, Python is a great language to do AoC, but I discovered Rust shortly after finishing that year and switched allegiance.
Each day is it's own binary which can be found in subfolders. Go here to run (or test) the days, and get the actual answers.
- 2015
- 2016
- 2017
- 2018
- 2019 - not yet started
- 2020 - not yet started, I do have some solutions here from when I was starting out. They need to be re-written in the standard format and generally made less bad
- 2021 - not yet started, although I do have a python repo
- 2022
- 2023
- 2024
In addition to the days themselves, this top-level folder contains a command line runner application that will time profile the days in a selected year.
I also have a sub-application that will look for any missing input files and download them automatically. For more info, see here.
Finally, I have a template folder with a template of a day for quickly getting another day added. There's not much of interest in here.
To start, you need 🦀 Rust installed 🦀
- Performance profiler: at the root directory, run
cargo run --release
N.B. This won't output any answers, just the calc runtime - Run a day: navigate to the relevant directory, e.g.
cd 2015/day_01
, and thencargo run --release
- Test a day: Most days have tests based on the example cases given in the problem description.
To run these, navigate to the day directory & run
cargo test
Not the most streamlined process, this may change:
- Copy the template folder to the new day e.g.
cp -r template 2015/day_01
- Edit the package name in the Cargo.toml file for the newly copied day. The name format is
day_yyyy_dd
- Uncomment the newly added day in the top-level app's Cargo.toml
- Update the relevant array in src/days.rs to include the new day. Note you will need to increase the size of the array as well as uncommenting the day line
- Download the inputs by running
cargo aoc-inputs
. This needs to be installed first, see here for more info - From the root folder, run the main app to check the new day shows up and runs without error
cargo run --release
- Navigate to the new day & start coding 😣
Adding a new year will be a bit more work over and above these steps
Stats generated on an Azure VM running Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz
2015
All Days: 555.24ms
2016
All Days: 15.15 s
2017
All Days: 978.00 ms
Day | Runtime | Percentage of year |
---|---|---|
Day 1: Inverse Captcha | 3.20 μs | 0% |
Day 2: Corruption Checksum | 22.50 μs | 0% |
Day 3: Spiral Memory | 3.10 μs | 0% |
Day 4: High-Entropy Passphrases | 303.60 μs | 0% |
Day 5: A Maze of Twisty Trampolines, All Alike | 101.56 ms | 10% |
Day 6: Memory Reallocation | 4.62 ms | 0% |
Day 7: Recursive Circus | 489.70 μs | 0% |
Day 8: I Heard You Like Registers | 393.80 μs | 0% |
Day 9: Stream Processing | 185.80 μs | 0% |
Day 10: Knot Hash | 170.10 μs | 0% |
Day 11: Hex Ed | 450.50 μs | 0% |
Day 12: Digital Plumber | 535.80 μs | 0% |
Day 13: Packet Scanners | 29.10 μs | 0% |
Day 14: Disk Defragmentation | 9.86 ms | 0% |
Day 15: Dueling Generators | 475.21 ms | 48% |
Day 16: Permutation Promenade | 18.07 ms | 1% |
Day 17: Spinkock | 3.93 ms | 0% |
Day 18: Duet | 3.61 ms | 0% |
Day 19: A Series of Tubes | 146.80 μs | 0% |
Day 20: Particle Swarm | 27.98 ms | 2% |
Day 21: Fractal Art | 55.80 μs | 0% |
Day 22: Sporifica Virus | 151.92 ms | 15% |
Day 23: Coprocessor Conflagration | 375.90 μs | 0% |
Day 24: Electromagnetic Moat | 130.98 ms | 13% |
Day 25: The Halting Problem | 46.84 ms | 4% |
2018
All Days: 7.40 ms part completed
Day | Runtime | Percentage of year |
---|---|---|
Day 1: Chronal Calibration | 2.89 ms | 43% |
Day 2: Inventory Management System | 195.90 μs | 2% |
Day 3: No Matter How You Slice It | 2.18 ms | 30% |
Day 4: Repose Record | 653.70 μs | 8% |
Day 5: Alchemical Reduction | 1.04 ms | 14% |
2019
No solutions yet written
2020
No solutions yet written
2021
No solutions yet written
2022
All Days: 2.86s
Day | Runtime | Percentage of year |
---|---|---|
Day 1: Calorie Counting | 98.30 μs | 0% |
Day 2: Rock Paper Scissors | 152.80 μs | 0% |
Day 3: Rucksack Reorganization | 135.00 μs | 0% |
Day 4: Camp Cleanup | 209.70 μs | 0% |
Day 5: Supply Stacks | 139.40 μs | 0% |
Day 6: Tuning Trouble | 13.70 μs | 0% |
Day 7: No Space Left On Device | 55.10 μs | 0% |
Day 8: Treetop Tree House | 109.30 μs | 0% |
Day 9: Rope Bridge | 654.40 μs | 0% |
Day 10: Cathode-Ray Tube | 27.30 μs | 0% |
Day 11: Monkey in the Middle | 11.20 ms | 0% |
Day 12: Hill Climbing Algorithm | 545.70 μs | 0% |
Day 13: Distress Signal | 235.70 μs | 0% |
Day 14: Regolith Reservoir | 15.86 ms | 0% |
Day 15: Beacon Exclusion Zone | 39.50 μs | 0% |
Day 16: Proboscidea Volcanium | 1.01 s | 35% |
Day 17: Pyroclastic Flow | 397.60 μs | 0% |
Day 18: Boiling Boulders | 183.06 ms | 6% |
Day 19: Not Enough Minerals | 170.59 ms | 5% |
Day 20: Grove Positioning System | 178.75 ms | 6% |
Day 21: Monkey Math | 3.60 ms | 0% |
Day 22: Monkey Map | 3.10 ms | 0% |
Day 23: Unstable Diffusion | 242.24 ms | 8% |
Day 24: Blizzard Basin | 1.03 s | 36% |
Day 25: Full of Hot Air | 15.30 μs | 0% |
2023
All Days: 497.24 ms part completed
Day | Runtime | Percentage of year |
---|---|---|
Day 1: Trebuchet?! | 193.61 μs | 0% |
Day 2: Cube Conundrum | 168.91 μs | 0% |
Day 3: Gear Ratios | 125.71 μs | 0% |
Day 4: Scratchcards | 187.41 μs | 0% |
Day 5: If You Give A Seed A Fertilizer | 354.02 μs | 0% |
Day 6: Wait For It | 2.80 μs | 0% |
Day 7: Camel Cards | 559.34 μs | 0% |
Day 8: Haunted Wasteland | 656.54 μs | 0% |
Day 9: Mirage Maintenance | 374.72 μs | 0% |
Day 10: Pipe Maze | 449.33 μs | 0% |
Day 11: Cosmic Expansion | 302.30 μs | 0% |
Day 12: Hot Springs | 117.56 ms | 23% |
Day 13: Point of Incidence | 143.40 μs | 0% |
Day 14: Parabolic Reflector Dish | 60.46 ms | 11% |
Day 15: Lens Library | 464.20 μs | 0% |
Day 16: The Floor Will Be Lava | 29.05 ms | 5% |
Day 17: Clumsy Crucible | 127.08 ms | 24% |
Day 18: Lavaduct Lagoon | 442.20 μs | 0% |
Day 19: Aplenty | 742.00 μs | 0% |
Day 20: Pulse Propagation | 3.33 ms | 0% |
Day 21: Step Counter | 2.00 ms | 0% |
Day 22: Sand Slabs | 107.78 ms | 22% |
Day 23: A Long Walk | 52.11 ms | 10% |
2023
All Days: 358.90 μs part completed
Day | Runtime | Percentage of year |
---|---|---|
Day 1: Historian Hysteria | 107.80 μs | 30% |
Day 2: Red-Nosed Reports | 251.10 μs | 69% |