Stylish! ๐
Stylish! ๐
Fun fact: The cache hit rate is consistently over 65% per design, but it can reach into the 90s in some cases.
I just completed "Linen Layout" - Day 19 - Advent of Code 2024 #AdventOfCode adventofcode.com/2024/day/19
Part1 was trivial. Part2, I went in circles debugging the stop conditions of my recursion only to realize the solution space was huge. Used python's caching decorator (functools.lru_cache)
Meant 3-bit computer (0 to 7 decimal).
"This seems to be a 3-bit computer: its program is a list of 3-bit numbers (0 through 7), like 0,1,2,3. The computer also has three registers named A, B, and C, but these registers aren't limited to 3 bits and can instead hold any integer."
The 7-bit computer hint means outputs depend only on the lower 3 bits of registers at each step. I built A incrementally, testing just 8 values (0-7) for each 3-bit chunk, which massively reduced the search space.
Managed to solve it with the hint that this is a 7-bit computer, so this can dramatically reduce the search space.
Here is my program:
Program: 2,4,1,5,7,5,4,3,1,6,0,3,5,5,3,0
I just completed "RAM Run" - Day 18 - Advent of Code 2024 #AdventOfCode adventofcode.com/2024/day/18
Not quite sure why this one was so easy. Re-used my Dijkstra's search from Day 16. Part2 was just simple iteration.
Yep. Figured that later. ๐
I just completed "Chronospatial Computer" - Day 17 - Advent of Code 2024 #AdventOfCode adventofcode.com/2024/day/17
Part1 was fun.
Part2, tried to brute force a sequencial search with early exit.
Didn't work.
Tried caching.
Didn't work.
Finally got it after re-reading the entire (hint!) puzzle.
Thanks! You just saved me a couple billions of linear searching. ๐
The drop rate on #AventofCode is quite something.
I imagine it should be possible with some prunning heuristics on score and possibly distance to the objective, but I don't think my laptop would get there. Running BFS took 10min for part2, I was starting to wonder if it would produce a result during my lifetime. ๐
Yep. Tried that.
I just completed "Reindeer Maze" - Day 16 - Advent of Code 2024 #AdventOfCode adventofcode.com/2024/day/16
Not getting any easier. Part1, failed miserably going depth-first, and had to call upon our friend Dijkstra with a priority heap queue. Part2 took like 10 min to compute. ๐ซข
#Surfskating in Cascais today
Sure! I'll give you a hint. I created a simple function that scores the position of the bots according to their proximity to other bots. Let me know if you need more details!
That could work but there are much simpler and cheaper solutions, like scoring how close bots are to each other.
Oh wow! That's "creative" ๐
I solved it on paper first. It's really just a simple system of two linear equations with two unknown variables, so it has only one possible solution.
I just completed "Restroom Redoubt" - Day 14 - Advent of Code 2024 #AdventOfCode adventofcode.com/2024/day/14
This was super fun to solve. For part2 I first tried to visualize a time-lapse but that took way too long. Had to come up with a clustering heuristic that did the trick!
I just completed "Claw Contraption" - Day 13 - Advent of Code 2024 #AdventOfCode adventofcode.com/2024/day/13
So proud of myself! It's the first time I do part2 in seconds because I made smart choices in part1 by choosing not to brute force.
I just completed "Garden Groups" - Day 12 - Advent of Code 2024 #AdventOfCode adventofcode.com/2024/day/12
Took me a while to get part2 logic nailed - and finally it was working in all examples, but failing for the input ๐คฏ. Very painful. I think I got garden fencing PTSD now.
This is what we call "December" around here
Love the ballanced and sober position. Looking forward to that engineer-to-engineer sharing and learning.
I just completed "Plutonian Pebbles" - Day 11 - Advent of Code 2024 #AdventOfCode adventofcode.com/2024/day/11
This one was super fun! Got part1 in less than 20min, but no amount of optimization would work for part2. Had to come with a completely new strategy, and that took a while!
I just completed "Hoof It" - Day 10 - Advent of Code 2024 #AdventOfCode adventofcode.com/2024/day/10
Part2 made me sweat quite a bit. Troubleshooting recursion on very large inputs was not fun.
I just completed "Disk Fragmenter" - Day 9 - Advent of Code 2024 #AdventOfCode adventofcode.com/2024/day/9
I just completed "Resonant Collinearity" - Day 8 - Advent of Code 2024 #AdventOfCode adventofcode.com/2024/day/8
Lesson of the day: Python does "short-circuit evaluation" for boolean expressions. Using "|" instead of "or" did the trick.
I just completed "Bridge Repair" - Day 7 - Advent of Code 2024 #AdventOfCode adventofcode.com/2024/day/7
Lesson of the day: never use mutable data structures in recursive functions. ๐คฆโโ๏ธ
I just completed "Guard Gallivant" - Day 6 - Advent of Code 2024 #AdventOfCode adventofcode.com/2024/day/6
Learned a very humbling lesson about the difference between deepcopy and shallowcopy in python. ๐ซ