Skip to content

jmacadie/aoc-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Advent of Code solutions

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.

Structure

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

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.

How to run

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 then cargo 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

To add a new day

Not the most streamlined process, this may change:

  1. Copy the template folder to the new day e.g. cp -r template 2015/day_01
  2. Edit the package name in the Cargo.toml file for the newly copied day. The name format is day_yyyy_dd
  3. Uncomment the newly added day in the top-level app's Cargo.toml
  4. 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
  5. Download the inputs by running cargo aoc-inputs. This needs to be installed first, see here for more info
  6. From the root folder, run the main app to check the new day shows up and runs without error cargo run --release
  7. Navigate to the new day & start coding 😣

Adding a new year will be a bit more work over and above these steps

Performance

Stats generated on an Azure VM running Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz

2015

All Days: 555.24ms

Day Runtime Percentage of year
Day 1: Not Quite Lisp 14.80 μs 0%
Day 2: I Was Told There Would Be No Math 154.80 μs 0%
Day 3: Perfect Spherical Houses in a Vacuum 674.90 μs 0%
Day 4: The Ideal Stocking Stuffer 282.74 ms 50%
Day 5: Dosen't He Have Intern-Elves For This? 331.40 μs 0%
Day 6: Probably a Fire Hazard 25.19 ms 4%
Day 7: Some Assembly Required 16.48 ms 2%
Day 8: Matchsticks 40.60 μs 0%
Day 9: All in a Single Night 20.01 ms 3%
Day 10: Elves Look, Elves Say 62.95 ms 11%
Day 11: Corporate Policy 52.00 ms 9%
Day 12: JSAbacusFramework.io 177.30 μs 0%
Day 13: Knights of the Dinner Table 3.16 ms 0%
Day 14: Reindeer Olympics 249.40 μs 0%
Day 15: Science for Hungry People 165.70 μs 0%
Day 16: Aunt Sue 209.30 μs 0%
Day 17: No Such Thing as Too Much 7.24 ms 1%
Day 18: Like a GIF For Your Yard 47.98 ms 8%
Day 19: Medicine for Rudolph 51.70 μs 0%
Day 20: Infinite Elves and Infinite Houses 451.30 μs 0%
Day 21: RPG Simulator 20XX 478.30 μs 0%
Day 22: Wizard Simulator 20XX 26.53 ms 4%
Day 23: Opening the Turing Lock 14.30 μs 0%
Day 24: It Hangs in the Balance 7.95 ms 1%
Day 25: Let It Snow 1.50 μs 0%
2016

All Days: 15.15 s

Day Runtime Percentage of year
Day 1: No Time for a Taxicab 60.50 μs 0%
Day 2: Bathroom Security 45.00 μs 0%
Day 3: Squares With Three Sides 346.30 μs 0%
Day 4: Security Through Obscurity 1.95 ms 0%
Day 5: How About a Nice Game of Chess? 5.52 s 36%
Day 6: Signals and Noise 211.10 μs 0%
Day 7: Internet Protocol Version 7 2.09 ms 0%
Day 8: Two-Factor Authentication 44.90 μs 0%
Day 9: Explosives in Cyberspace 31.90 μs 0%
Day 10: Balance Bots 87.10 μs 0%
Day 11: Radioisotope Thermoelectric Generators 46.63 ms 0%
Day 12: Leonardo's Monorail 3.40 μs 0%
Day 13: A Maze of Twisty Little Cubicles 57.10 μs 0%
Day 14: One-Time Pad 9.51 s 63%
Day 15: Timing is Everything 8.60 μs 0%
Day 16: Dragon Checksum 2.60 μs 0%
Day 17: Two Steps Forward 27.39 ms 0%
Day 18: Like a Rogue 1.19 ms 0%
Day 19: An Elephant Named Joseph 1.50 μs 0%
Day 20: Firewall Rules 128.00 μs 0%
Day 21: Scrambled Letters and Hash 41.40 μs 0%
Day 22: Grid Computing 1.22 ms 0%
Day 23: Safe Cracking 2.30 μs 0%
Day 24: Air Duct Spelunking 699.40 μs 0%
Day 25: Clock Signal 305.41 μs 0%
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%

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages