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.

2023 (Go)

Day Part 1 Part 2 Stars
Day 1: Trebuchet?! 475µs 1.535ms ⭐⭐
Day 2: Cube Conundrum 380µs 265µs ⭐⭐
Day 3: Gear Ratios 361µs 2.123ms ⭐⭐
Day 4: Scratchcards 3.021ms 25.751ms ⭐⭐
Day 5: If You Give a Seed A Fertilizer 456µs 1.962ms ⭐⭐
Day 6: Wait For It 22µs 21µs ⭐⭐
Day 7: Camel Cards 1.123ms 1.065ms ⭐⭐
Day 8: Haunted Wasteland 554µs 2.491ms ⭐⭐
Day 9: Mirage Maintenance 710µs 737µs ⭐⭐
Day 10: Pipe Maze 6.338ms 7.215ms ⭐⭐
Day 11: Cosmic Expansion 9.962ms 13.389ms ⭐⭐
Day 12: Hot Springs 2.36ms 89.622ms ⭐⭐
Day 13: Point of Incidence 558µs 60.186ms ⭐⭐
Day 14: Parabolic Reflector Dish 6.515ms 490.216ms ⭐⭐
Day 15: Lens Library 172µs 1.019ms ⭐⭐
Day 16: The Floor Will Be Lava 4.899ms 875.253ms ⭐⭐

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 213µs 212µs ⭐⭐
Day 2: Rock Paper Scissors 271µs 310µs ⭐⭐
Day 3: Rucksack Reorganization 337µs 183µs ⭐⭐
Day 4: Camp Cleanup 643µs 644µs ⭐⭐
Day 5: Supply Stacks 778µs 750µs ⭐⭐
Day 6: Tuning Trouble 371µs 2.078ms ⭐⭐
Day 7: No Space Left On Device 222µs 186µs ⭐⭐
Day 8: Treetop Tree House 312µs 1.272ms ⭐⭐
Day 9: Rope Bridge 975µs 1.725ms ⭐⭐
Day 10: Cathode-Ray Tube 42µs 112µs ⭐⭐
Day 11: Monkey in the Middle 88µs 15.681ms ⭐⭐
Day 12: Hill Climbing Algorithm 4.244ms 2.881ms ⭐⭐

2021 (Odin)

Day Part 1 Part 2 Stars
Day 1: Sonar Sweep 443µs 807µs ⭐⭐
Day 2: Dive! 679µs 834µs ⭐⭐
Day 3: Binary Diagnostic 346µs 577µs ⭐⭐
Day 4: Giant Squid 779µs 1.221ms ⭐⭐
Day 5: Hydrothermal Venture 48.474ms 88.501ms ⭐⭐
Day 6: Lanternfish 96µs 134µs ⭐⭐
Day 7: The Treachery of Whales 1.196ms 1.565ms ⭐⭐