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?! 427µs 1.544ms ⭐⭐
Day 2: Cube Conundrum 403µs 356µs ⭐⭐
Day 3: Gear Ratios 443µs 2.082ms ⭐⭐
Day 4: Scratchcards 2.949ms 25.556ms ⭐⭐
Day 5: If You Give a Seed A Fertilizer 472µs 2.014ms ⭐⭐
Day 6: Wait For It 21µs 21µs ⭐⭐
Day 7: Camel Cards 1.086ms 1.028ms ⭐⭐
Day 8: Haunted Wasteland 539µs 2.473ms ⭐⭐
Day 9: Mirage Maintenance 643µs 732µs ⭐⭐
Day 10: Pipe Maze 6.227ms 7.523ms ⭐⭐
Day 11: Cosmic Expansion 9.846ms 12.848ms ⭐⭐
Day 12: Hot Springs 2.161ms 88.169ms ⭐⭐
Day 13: Point of Incidence 568µs 60.713ms ⭐⭐
Day 14: Parabolic Reflector Dish 10.051ms 499.625ms ⭐⭐
Day 15: Lens Library 134µs 934µs ⭐⭐
Day 16: The Floor Will Be Lava 4.64ms 859.417ms ⭐⭐

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 208µs 218µs ⭐⭐
Day 2: Rock Paper Scissors 264µs 253µs ⭐⭐
Day 3: Rucksack Reorganization 262µs 167µs ⭐⭐
Day 4: Camp Cleanup 739µs 706µs ⭐⭐
Day 5: Supply Stacks 773µs 686µs ⭐⭐
Day 6: Tuning Trouble 301µs 2.091ms ⭐⭐
Day 7: No Space Left On Device 178µs 197µs ⭐⭐
Day 8: Treetop Tree House 355µs 1.269ms ⭐⭐
Day 9: Rope Bridge 961µs 1.783ms ⭐⭐
Day 10: Cathode-Ray Tube 35µs 59µs ⭐⭐
Day 11: Monkey in the Middle 100µs 13.561ms ⭐⭐
Day 12: Hill Climbing Algorithm 3.762ms 2.833ms ⭐⭐

2021 (Odin)

Day Part 1 Part 2 Stars
Day 1: Sonar Sweep 436µs 815µs ⭐⭐
Day 2: Dive! 622µs 597µs ⭐⭐
Day 3: Binary Diagnostic 283µs 531µs ⭐⭐
Day 4: Giant Squid 634µs 1.125ms ⭐⭐
Day 5: Hydrothermal Venture 47.44ms 83.512ms ⭐⭐
Day 6: Lanternfish 102µs 147µs ⭐⭐
Day 7: The Treachery of Whales 1.244ms 1.589ms ⭐⭐
Day 8: Seven Segment Search 422µs 5.056ms ⭐⭐
Day 9: Smoke Basin 681µs 7.667ms ⭐⭐
Day 10: Syntax Scoring 958µs 1.247ms ⭐⭐