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 195µs 280µs ⭐⭐
Day 2: Red-Nosed Reports 425µs 1ms ⭐⭐
Day 3: Mull It Over 57µs 60µs ⭐⭐
Day 4: Ceres Search 466µs 133µs ⭐⭐
Day 5: Print Queue 819µs 1.4ms ⭐⭐
Day 6: Guard Gallivant 3.6ms 642.4ms ⭐⭐
Day 7: Bridge Repair 1.6ms 25.7ms ⭐⭐
Day 8: Resonant Collinearity 171µs 377µs ⭐⭐
Day 9: Disk Fragmenter 1.5ms 437.8ms ⭐⭐
Day 10: Hoof It 441µs 426µs ⭐⭐
Day 11: Plutonian Pebbles 1.1ms 32.7ms ⭐⭐
Day 12: Garden Groups 5.9ms 19.7ms ⭐⭐
Day 13: Claw Contraption 113µs 121µs ⭐⭐

2023 (Go)

Day Part 1 Part 2 Stars
Day 1: Trebuchet?! 449µs 1.522ms ⭐⭐
Day 2: Cube Conundrum 384µs 318µs ⭐⭐
Day 3: Gear Ratios 413µs 1.771ms ⭐⭐
Day 4: Scratchcards 3.106ms 25.968ms ⭐⭐
Day 5: If You Give a Seed A Fertilizer 489µs 1.953ms ⭐⭐
Day 6: Wait For It 21µs 24µs ⭐⭐
Day 7: Camel Cards 1.037ms 1.025ms ⭐⭐
Day 8: Haunted Wasteland 519µs 2.486ms ⭐⭐
Day 9: Mirage Maintenance 643µs 651µs ⭐⭐
Day 10: Pipe Maze 6.518ms 8.131ms ⭐⭐
Day 11: Cosmic Expansion 12.424ms 14.935ms ⭐⭐
Day 12: Hot Springs 2.242ms 95.148ms ⭐⭐
Day 13: Point of Incidence 588µs 62.229ms ⭐⭐
Day 14: Parabolic Reflector Dish 6.439ms 486.519ms ⭐⭐
Day 15: Lens Library 157µs 1.003ms ⭐⭐
Day 16: The Floor Will Be Lava 5.092ms 880.827ms ⭐⭐

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 162µs 192µs ⭐⭐
Day 2: Rock Paper Scissors 256µs 291µs ⭐⭐
Day 3: Rucksack Reorganization 301µs 229µs ⭐⭐
Day 4: Camp Cleanup 696µs 617µs ⭐⭐
Day 5: Supply Stacks 666µs 683µs ⭐⭐
Day 6: Tuning Trouble 296µs 2.004ms ⭐⭐
Day 7: No Space Left On Device 163µs 120µs ⭐⭐
Day 8: Treetop Tree House 253µs 1.243ms ⭐⭐
Day 9: Rope Bridge 1.049ms 1.738ms ⭐⭐
Day 10: Cathode-Ray Tube 37µs 45µs ⭐⭐
Day 11: Monkey in the Middle 68µs 13.826ms ⭐⭐
Day 12: Hill Climbing Algorithm 3.822ms 3.357ms ⭐⭐

2021 (Odin)

Day Part 1 Part 2 Stars
Day 1: Sonar Sweep 86µs 208µs ⭐⭐
Day 2: Dive! 138µs 147µs ⭐⭐
Day 3: Binary Diagnostic 42µs 368µs ⭐⭐
Day 4: Giant Squid 205µs 404µs ⭐⭐
Day 5: Hydrothermal Venture 23.709ms 40.017ms ⭐⭐
Day 6: Lanternfish 11µs 12µs ⭐⭐
Day 7: The Treachery of Whales 509µs 724µs ⭐⭐
Day 8: Seven Segment Search 72µs 1.214ms ⭐⭐
Day 9: Smoke Basin 160µs 2.957ms ⭐⭐
Day 10: Syntax Scoring 361µs 497µs ⭐⭐
Day 11: Dumbo Octopus 155µs 392µs ⭐⭐
Day 12: Passage Pathfinding 3.015ms 65.784ms ⭐⭐
Day 13: Transparent Oragami 509µs 1.625ms ⭐⭐