D12 reminds me of another path-finding question in last season, and this is when we start to explore the limit of Alteryx as a "pseudo programming language", I think.
I think the method I used is closest to the "Breath-First Search (BFS)" algorithm (TBH when I did the workflow I did not know this is called BFS). This algorithm is considered greedy and probably is the reason it took 16.8 seconds to run Part 1 but a whopping ~50min to run part 2 on my laptop (Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz 2.59 GHz, 8GB RAM). There is definitely a more efficient BaseA solution and I look forward to see the solutions by the wizards amongst us :-)
Part 2 macro (which uses part 1 macro)
Inspiration struck when I was having dinner with my husband... so I flipped the workflow to a reverse Dijkstra and voila both part 1 and part 2 finished together in 40 seconds. See hint in the spoiler 😎
It took a couple tweaks to keep the macro from blowing up the count.
Macro:
Day 12 done ! ✔️
It's not pretty, it doesn't even fully work, but it gives the solution ! 👌
Workflow
Macro
I finishes today'ss challenge using Breadth First Search algorithm. Today, I didn't have a concentable time because of my work. As a result, I did this challenge after the work.
Not an easy one and h/t @patrick_digan 's solution for removing already-seen paths, which was my main struggle.
Thankful for @patrick_digan 's hint about keeping rows from exploding. My original solution was very close but couldn't keep the row count small enough.
thankful for @patrick_digan for the tips.
macro:add a message tool as a stopper when have a solution.
thank you for the tips - I have used Djinkstra with slight modification and finally managed to solve the issue
makro:
Finally caught up on Day 12! Part 1 was incredibly quick to run... The time taken for part 2 to complete shall remain a secret other than to those that were present in the Alteryx friends & AoC virtual happy hour!
Batch macro to load in all a starts:
Iterative macro - generates possible next steps for the current tile until an end is met:
Part 1 was the same approach without the batch!
Edit: Upon reversing the logic and starting from the End - as suggested by @DavidP and others - my Part 2 actually ran in 18.6 seconds which is a whopping 1,490 times faster than my first attempt!
OK - so this took 1.5 days but it's done. Main snag was a silly logical error on part 2 where instead of running the part 1 once for each new starting point, I was running it once per each cell in each starting point.
Solution summary in spoiler below.
This is pretty simple - it just takes every cell; joins it to each of its neighbours and checks if the move is valid ( based on height).This gives you a simple list of which transitions from cell X to cell Y are allowed.
I meant to post this earlier, but kept forgetting. Here it is, at last, the "reserve Dijkstra" macro that helps me solve both part 1 and part 2 together in 65 seconds :-) @Mildman
I used this same macro, with some modifications to solve for one or two other AoC too. Cheers,Dawn.
just submitting my backlog of old challenges