Discussion thread for day 15 of the Advent of Code - https://adventofcode.com/2024/day/15
I'm happy to use Alteryx even in the weekend.
REGEX_Replace([Concat_Object], "(^.*#[^#]*?)(\.?)(O*@)$", "$1$3$2")
(EDIT)
Optimized my WF for Part2: 7minutes. I could not make it faster any more.
My solution.
It takes about 7min.
Day15. More in spoiler
This one was a bit of a beast... happy to have managed to get almost all of it done while riding shotgun for two long car rides yesterday as well... and special shoutout to my fiancé for driving and letting me work on Advent of Code.
Part 1 I approached essentially the exact same way I did Day 6 part 1 (for one time through at least with that guard it ran fairly quickly so thought I would try that route again). Part 2 (once the new grid was prepped) I handled two different ways. For horizontal movement I treated it the same way as part 1, for vertical movement I decided to focus in on the objects in the path and used an additional nested iterative macro to do the checks for surrounding "big box" pieces and walls they might run into.
This took way longer than I hoped it would. I kept constantly crashing into bugs that were often trivial to fix, but difficult to find. I built a mechanism to capture all states of the map, and generated a video file to watch the robot on its route in the sample data to make sure nothing weird was happening... But that's all behind me now. No fancy algorithms, just good old fashioned brute force (with limited optimizations as well):
Finally, solved!
This is the one of the most difficult puzzle this year for me.
it difficult to find where the bug. it worked in sample but not the input.
Day15P2 was one of the most challenging problems to solve in this year’s AoC.
In P1, there were 20,000 loops, and initially, history was maitained, which caused errors in Alteryx. The box positions were swapped using regular expressions, but the processing in P1 was somewhat redundant.
For P2, I gave up reusing P1 and decided to rebuild it from scratch. After considerable thought, I referred to @Tokimatsu 's workflow for inspiration. By representing only the left side of "O" and "#" as representative points without actually increasing the "O" and "#", significant simplification was achieved.
First, a mapping table was created in Excel by drawing a diagram of which range of cells would be affected when "@" or "O" moved. When "@" moved, the influence range of the pushed cells were calculated. If there was a "#" within the range, the move was canceled; if there was no "#", a macro updated the positions of "@" and "O".
P1 took about 10 minutes to execute, and P2 took about 8 minutes.
<P1 Macro>
<P2 Macro to check the pushed cell>
<P2 Main Macro>