igorb
Advent of Code 2024 - Day 15
I found today a bit tedious: advent-of-code-2024/lib/advent_of_code2024/day15.ex at main · ibarakaiev/advent-of-code-2024 · GitHub.
Most Liked
igorb
Oh I’d hate to accidentally delete my code for this one… I usually use reduce_while/3 if I need to return early. Tons of it in this problem.
lud
I thought it was going to be tedious at first but in the end, just a couple modifications from part one are enough. This runs in 15ms:
Aetherus
For example, in the following case
######
#...##
#[][]#
#.[].#
#.@..#
######
^
In this case, I try to push the box on the 4th row upward, which in requires pushing the left box on the 3rd row upward (ok), then the right box on the 3rd row upward (failed). In traditional programming language, you need to pull back the left box (backtracking), but in Elixir, you just need to use the state before pushing.
lud
I think he wants you to find the edge cases by yourself ! Otherwise it would be just an optimization game…
Do you want to explain your approach so we can spot something missing ?
ken-kost
touché
The thing is I “observed” the robot… must have missed another misbehaviour. I’m just complaining, this one is actually debuggable.
I’ll give it another go tomorrow, then if I give up, I’ll complain further. ![]()







