Discussion thread for day 16 of the Advent of Code - https://adventofcode.com/2024/day/16
This problem is not as complicated as it may seem initially (once you understand the algorithm behind it):
I love spatial analysis. For part2, it took 10min but I'm satisfied with it.
I do like to trace a path. Part 2 wasn't any harder than Part1 since you already have the target number.
Assorted notes:
D16. More in spoiler
Done.
I revised the (WF over and over again, but I finally managed to complete it. WF runs in 8 seconds for P1 and P2.
In P1, progressing one cell at a time was too time-consuming, so process is optimized by using "Make Group" Tool to group linear sections. Within the iterative macro, only cases with the minimum length for each point at the same loop were retained for processing.
In P2, running the normal approach caused the number of cases to increase exponentially. To address this, only the paths that matched the shortest length to each point determined in P1 are remainind in iterative macro. Since the required path was determined as a straight polyline, Spatial Match Tool is ussd to identify the points along the path.
Not sure whether to be very happy that my original part 1 approach only needed the SLIGHTEST of tweaks to work extremely well and fast to get me the solution to part 2... or to be very mad at the fact that I wasted much of my afternoon/evening going down different paths trying to get other things to work first before coming back to what I had originally...