Skip to content

🎄 Home to all of my Go & Odin solutions for Advent of Code 🎄

License

Notifications You must be signed in to change notification settings

scottmckendry/AoC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Advent of Code 📆

All my solutions to the Advent of Code challenges, written in Go/Odin. Possibly the only thing I will ever get into the Christmas spirit for 🎄

grinch

Project Structure

I've separated each year into its own Go module. Each day is separated into two files, one for each part of the challenge. To run a solution, simply cd into the directory and run go run . -solution 01p1 (where 01p1 is the day and part you want to run). The -benchmark flag can be used to time the execution of the solution. Using the -benchmark flag on its own will run all solutions for the year 10 times over, getting the average execution time.

The same is true for Odin solutions, except the command to run the solution is odin run . -solution 01p1.

Note

Benchmarks are run via this GitHub Action and are not indicative of the performance of the code on your machine. The action uses the ubuntu-latest image and runs each solution 10 times to get an average. This is by no means a perfect benchmark, so take the results below with a grain of salt.

2024 (Odin)

Day Part 1 Part 2 Stars
Day 1: Historian Hysteria 231µs 305µs ⭐⭐
Day 2: Red-Nosed Reports 467µs 1ms ⭐⭐
Day 3: Mull It Over 69µs 71µs ⭐⭐
Day 4: Ceres Search 478µs 146µs ⭐⭐
Day 5: Print Queue 834µs 1.4ms ⭐⭐
Day 6: Guard Gallivant 3.6ms 651.1ms ⭐⭐
Day 7: Bridge Repair 1.7ms 27.2ms ⭐⭐
Day 8: Resonant Collinearity 198µs 430µs ⭐⭐
Day 9: Disk Fragmenter 1.6ms 443.1ms ⭐⭐
Day 10: Hoof It 441µs 422µs ⭐⭐
Day 11: Plutonian Pebbles 1.1ms 32.1ms ⭐⭐
Day 12: Garden Groups 5.8ms 19.5ms ⭐⭐
Day 13: Claw Contraption 129µs 132µs ⭐⭐
Day 14: Restroom Redoubt 224µs 201ms ⭐⭐

2023 (Go)

Day Part 1 Part 2 Stars
Day 1: Trebuchet?! 441µs 1.458ms ⭐⭐
Day 2: Cube Conundrum 375µs 318µs ⭐⭐
Day 3: Gear Ratios 415µs 1.809ms ⭐⭐
Day 4: Scratchcards 3.057ms 25.831ms ⭐⭐
Day 5: If You Give a Seed A Fertilizer 543µs 2.069ms ⭐⭐
Day 6: Wait For It 17µs 20µs ⭐⭐
Day 7: Camel Cards 1.074ms 1.719ms ⭐⭐
Day 8: Haunted Wasteland 599µs 2.498ms ⭐⭐
Day 9: Mirage Maintenance 703µs 756µs ⭐⭐
Day 10: Pipe Maze 6.455ms 7.645ms ⭐⭐
Day 11: Cosmic Expansion 11.252ms 13.424ms ⭐⭐
Day 12: Hot Springs 2.125ms 93.538ms ⭐⭐
Day 13: Point of Incidence 586µs 62.816ms ⭐⭐
Day 14: Parabolic Reflector Dish 6.433ms 486.307ms ⭐⭐
Day 15: Lens Library 150µs 1.026ms ⭐⭐
Day 16: The Floor Will Be Lava 4.883ms 874.961ms ⭐⭐

TODO:

  • In the process of improving the performance of Day 5 part 2, I've gone and broken it to the point where it no longer gives the correct answer. So while it is an improvement of the original 1.5 hours, it still needs some work.
  • Day 16 part 2 uses a brute force approach to find the answer. I'm certain with heavy caching and dynamic programming, it could be improved significantly.

2022 (Go)

Day Part 1 Part 2 Stars
Day 1: Calorie Counting 214µs 203µs ⭐⭐
Day 2: Rock Paper Scissors 243µs 257µs ⭐⭐
Day 3: Rucksack Reorganization 212µs 136µs ⭐⭐
Day 4: Camp Cleanup 684µs 681µs ⭐⭐
Day 5: Supply Stacks 709µs 694µs ⭐⭐
Day 6: Tuning Trouble 294µs 2.046ms ⭐⭐
Day 7: No Space Left On Device 219µs 125µs ⭐⭐
Day 8: Treetop Tree House 227µs 1.407ms ⭐⭐
Day 9: Rope Bridge 1.019ms 1.673ms ⭐⭐
Day 10: Cathode-Ray Tube 33µs 46µs ⭐⭐
Day 11: Monkey in the Middle 70µs 15.265ms ⭐⭐
Day 12: Hill Climbing Algorithm 3.687ms 2.947ms ⭐⭐

2021 (Odin)

Day Part 1 Part 2 Stars
Day 1: Sonar Sweep 90µs 165µs ⭐⭐
Day 2: Dive! 122µs 135µs ⭐⭐
Day 3: Binary Diagnostic 39µs 334µs ⭐⭐
Day 4: Giant Squid 186µs 324µs ⭐⭐
Day 5: Hydrothermal Venture 21.423ms 38.245ms ⭐⭐
Day 6: Lanternfish 10µs 12µs ⭐⭐
Day 7: The Treachery of Whales 452µs 677µs ⭐⭐
Day 8: Seven Segment Search 67µs 1.191ms ⭐⭐
Day 9: Smoke Basin 163µs 2.805ms ⭐⭐
Day 10: Syntax Scoring 352µs 421µs ⭐⭐
Day 11: Dumbo Octopus 160µs 313µs ⭐⭐
Day 12: Passage Pathfinding 2.364ms 56.695ms ⭐⭐
Day 13: Transparent Oragami 470µs 1.294ms ⭐⭐