Skip to content

Latest commit

 

History

History

2023

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Advent of Code 2023

Rust is still fun, but I might do some Go and also TypeScript with Bun this year. Will try to pair with ChatGPT to expand my knowledge on the algorithms that can be used.

Advent of Code 2023 Story

Something is wrong with global snow production, and you've been selected to take a look. The Elves have even given you a map; on it, they've used stars to mark the top fifty locations that are likely to be having problems.

You've been doing this long enough to know that to restore snow operations, you need to check all fifty stars by December 25th.

Collect stars by solving puzzles. Two puzzles will be made available on each day in the Advent calendar; the second puzzle is unlocked when you complete the first. Each puzzle grants one star. Good luck!

You try to ask why they can't just use a weather machine ("not powerful enough") and where they're even sending you ("the sky") and why your map looks mostly blank ("you sure ask a lot of questions") and hang on did you just say the sky ("of course, where do you think snow comes from") when you realize that the Elves are already loading you into a trebuchet ("please hold still, we need to strap you in").

Days

Day #1 #1 Answer #2 #2 Answer
Day 1: Trebuchet?! 🌟 54304 🌟 54418
Day 2: Cube Conundrum 🌟 2162 🌟 72513
Day 3: Gear Ratios 🌟 535235 🌟 79844424
Day 4: Scratchcards 🌟 27454 🌟 6857330
Day 5: If You Give A Seed A Fertilizer 🌟 993500720 🌟 4917124
Day 6: Wait For It 🌟 861300 🌟 28101347
Day 7: Camel Cards 🌟 250474325 🌟 248909434
Day 8: Haunted Wasteland 🌟 22411 🌟 11188774513823
Day 9: Mirage Maintenance 🌟 1853145119 🌟 923
Day 10: Pipe Maze 🌟 6882 🌟 491
Day 11: Cosmic Expansion 🌟 9795148 🌟 650672493820
Day 12: Hot Springs 🌟 8270 🌟 204640299929836
Day 13: Point of Incidence 🌟 27300 🌟 29276
Day 14: Parabolic Reflector Dish 🌟 108614 🌟 96447
Day 15: Lens Library 🌟 516070 🌟 244981
Day 16: The Floor Will Be Lava 🌟 7562 🌟 7793
Day 17: Clumsy Crucible 🌟 1013 🌟 1215
Day 18: Lavaduct Lagoon 🌟 48652 🌟 45757884535661
Day 19: Aplenty 🌟 331208 🌟 121464316215623
Day 20: Pulse Propagation 🌟 812609846 🌟 245114020323037
Day 21: Step Counter 🌟 3788 🌟 631357596621921
Day 22: Sand Slabs
Day 23: A Long Walk 🌟 2042 🌟 6466
Day 24: Never Tell Me The Odds
Day 25: Snowverload 🌟 548960 -

Performance

With the help of cargo-aoc I get automatic benchmarking using Criterion. Computer is a MacBook Pro M1 Pro, 32 GB RAM.

Day #1 #2 Improvement* Generator
1 40.71 µs 834.08 µs - / -31.03% 441.01 ns
2 764.68 ns 1.75 µs 47.81 µs
3 159.61 µs 7.72 ms -8.44% / - 86.83 µs
4 12.85 µs 13.09 µs -48.41% / -46.64% 230.06 µs
5 1.27 µs 238.45 ms** -16.72% / -98.87% 16.85 µs
6 101.59 ns 15.04 ms 257.13 ns / 204.78 ns
7 364.18 µs 359.22 µs 318.23 µs / 324.96 µs
8 926.09 µs 4.47 ms - / -70.69% 137.33 µs
9 2.44 µs 2.55 µs 434.07 µs
10 65.17 µs 65.01 µs -96.02% / - 50.84 µs
11 846.06 µs 844.65 µs 75.21 µs
12 2.65 ms 149.26 ms 113.10 µs
13 24.87 µs 17.61 µs 169.28 µs
14 19.30 µs 20.22 µs 23.69 µs
15 19.99 µs 210.88 µs - / -28.20% 241.12 µs
16 1.41 ms 49.39 ms 30.33 µs
17 64.21 ms 173.37 ms 47.36 µs
18 837.59 ns 844.43 ns 41.30 µs / 73.29 µs
19 55.27 µs 160.90 µs 213.26 µs
20 5.22 ms 24.31 ms 24.13 µs
21 1.48 ms 24.29 ms 43.68 µs
22
23 568.16 ms** 9.32 s** 43.68 µs
24
25 ms - µs

* compared to first solution
** slow, didn't benchmark. Value comes from running the solver.

Previous solutions

Day #1 #2 Improvement Link
1 - 1.19 ms Link
3 172.23 µs - Baseline Link
4 24.33 µs 24.32 µs Baseline Link
5 1.50 µs 21.22 s Baseline Link
8 - 15.25 ms Baseline Link
10 1.70 ms * - Baseline Link
15 - 292.04 µs Baseline Link

* BFS solution. I liked it, so it's still in the file.