Discussion thread for day 6 of the Advent of Code - https://adventofcode.com/2024/day/6
This is precisely when you realize Day 6 is hard 😂 No Solutions yet posted!
I'm reasonably confident in my solution. It's just that I estimate the runtime at ~600 hours.
That was the point at which I chose sleep.
😂😂
My solution, Part 1 is fairly quick, but Part 2 took 1hr and 10min to run:
My First Solution:
Main Workflow:
Move Guard (Iterative Macro):
Part 2: Place Obstacles (Batch Macro w/ Move Guard macro nested inside):
Amazing Solution (Thanks to @gawa for the idea to not nest macros): With the power of smart optimizations and memoization of the guard's corner stops this workflow solves Day 6 in 2 minutes and 30 seconds!!!:
Pretty Picture of Part 1 Guard's Trajectory:
This one is really hard 😂
First Part was running 17min and Second I have to fine tune as it will run forever :P
Sheesh. More in spoiler
Very satisfying to get this one cracked. Originally didn't have a clue how to tackle it but tested out a few approaches and got there in the end. P1 runtime was 1.7 seconds, P2 was 1 hour 42 mins. A huge thanks to @CoG for the golden tip on optimising iterations!
Brute force way. For part2, it'll take 8 hours in my computer😂😂😂
(Edit_ve2)
Instead of nested macro(Iterative Macro inside Batch Macro), I made attempt by single Iteration Macro, that run within 15min.
I maintain the same algorithm(brute force) as previous attempt but running time got much faster.
Nested Macro is 'easy for human to understand' but 'not easy for Alteryx to process'...maybe.
Solved!
Day 6 is toooooo hard. Normally this difficulty puzzle is served after day15.
This is not fast, but it is needed for part 2 input.
Part2 Batch macro(Place obstacles one by one from the path of Part1 and start the infinite loop detection macro):
Part2 finding the infinit loop macro :
To solve faster, I think that the gawa's parallel approach is needed.