/AoC

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

Primary LanguageGoMIT LicenseMIT

Advent of Code 📆

All my solutions to the Advent of Code challenges, written in Go. 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.

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

Day Part 1 Part 2 Stars
Day 1: Trebuchet?! 431µs 1.471ms ⭐⭐
Day 2: Cube Conundrum 414µs 267µs ⭐⭐
Day 3: Gear Ratios 356µs 1.519ms ⭐⭐
Day 4: Scratchcards 3.231ms 26.669ms ⭐⭐
Day 5: If You Give a Seed A Fertilizer 583µs 2.095ms ⭐⭐
Day 6: Wait For It 41µs 39µs ⭐⭐
Day 7: Camel Cards 991µs 944µs ⭐⭐
Day 8: Haunted Wasteland 537µs 2.515ms ⭐⭐
Day 9: Mirage Maintenance 755µs 703µs ⭐⭐
Day 10: Pipe Maze 7.332ms 8.337ms ⭐⭐
Day 11: Cosmic Expansion 13.256ms 18.195ms ⭐⭐
Day 12: Hot Springs 2.02ms 85.06ms ⭐⭐
Day 13: Point of Incidence 557µs 57.798ms ⭐⭐
Day 14: Parabolic Reflector Dish 6.341ms 469.463ms ⭐⭐
Day 15: Lens Library 170µs 956µs ⭐⭐
Day 16: The Floor Will Be Lava 4.064ms 827.063ms ⭐⭐

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

Day Part 1 Part 2 Stars
Day 1: Calorie Counting 217µs 221µs ⭐⭐
Day 2: Rock Paper Scissors 354µs 248µs ⭐⭐
Day 3: Rucksack Reorganization 407µs 290µs ⭐⭐
Day 4: Camp Cleanup 765µs 747µs ⭐⭐
Day 5: Supply Stacks 806µs 781µs ⭐⭐
Day 6: Tuning Trouble 347µs 2.087ms ⭐⭐
Day 7: No Space Left On Device 171µs 166µs ⭐⭐
Day 8: Treetop Tree House 225µs 1.284ms ⭐⭐
Day 9: Rope Bridge 927µs 1.712ms ⭐⭐
Day 10: Cathode-Ray Tube 32µs 56µs ⭐⭐
Day 11: Monkey in the Middle 93µs 13.002ms ⭐⭐
Day 12: Hill Climbing Algorithm 3.579ms 4.121ms ⭐⭐