Advent of Code 2024 Day 6 (BaseA Style)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Discussion thread for day 6 of the Advent of Code - https://adventofcode.com/2024/day/6
- Labels:
- Advent of Code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
This is precisely when you realize Day 6 is hard 😂 No Solutions yet posted!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
😂😂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
This one is really hard 😂
First Part was running 17min and Second I have to fine tune as it will run forever :P
And iterative macro
 
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Sheesh. More in spoiler
P2 took a while to figure out the setup that got me exceptionally close to the answer (off by single digits) and just guessed til I got it.
My approach was this, I needed four datasets:
1. Main map;
2. Existing boundaries (outside map listed as E for exit that I generated and # for current blockers);
3. Current Starting point;
4. Individual steps I got from P1 used a new boundary to generate a brute force batch macro
The goal was to determine if a given step would result in E for exiting the map or # for hitting a loop. My logic for hitting a loop was a point and direction combo that was previously seen in the path.
To make the batch macro more optimal (45 minutes vs endless) I just jumped ahead from any given point to the nearest boundary it would hit: # or exit E. If it hit a boundary in play, generate the new point similar to P1 and loop, if it hit an exit then the macro would end, as well as running into a previously seen path and direction.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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!
1) Keep a stored list of visited points and the direction - a loop is when you return to a matching point & direction
2) There's no need to run through every point - with the right logic you can 'jump' to the next obstacle-1, and generate a list of 'visited' tiles
3) You only need to insert extra obstacles at tiles you visited on Part 1 as you can't get to the rest of the grid
Main workflow:
Part 1 iterator:
Part 2 batch:
Part 2 iterator:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Solved!
Day 6 is toooooo hard. Normally this difficulty puzzle is served after day15.
Part 1 macro (moving the path step by step):
 
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 :Part 1's step by step macro is toooooo slow, so I had to re-create the macro. This macro will jump as far as possible in a straight line. But it is still slow. It took 2.5 hours to solve.
 
To solve faster, I think that the gawa's parallel approach is needed.
