Advent of Code 2023 Day 23 (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 23 of the Advent of Code - https://adventofcode.com/2023/day/23
- Labels:
- Advent of Code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Spent a lot of time thinking about how to solve this problem. Path Optimization problems are an area I can use some work in. My methods are probably not optimal, but I was able to use a couple clever strategies to my advantage, which felt good to come up with and execute!
Algorithm: (Plan to add later)
Workflow:
Maze Solving Iterative Macro (Part 1):
Graph Building Iterative Macro (Part 2):
Graph Traversal Iterative Macro (Part 2):
Happy Solving!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
For, Part1 Brute Force worked well, but for Part2, it didn't.
Then, I examine the input data carefully, and solved with Spatial Analysis.
Pls see spoiler for detail
By converting the map into spatial object, you will have the below objects.(To do so, you need to do a lot of work, I know)
By cutting out line objects into multiple lines by points object, you will have separate line objects(To do so, you need to buffer objects somewhat)
In Graph viz, it simply looks like
In short, you just have to solve based on the above graph, instead of the given input data that is too complicated and messy.
Calculation to get max distance took 1 min in my case. In process of iteration, max no. of record reached to millions but it reduced soon after some more iteration)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Part 1 is very simple. But part 2 is needed for the ingenuity.
Macro for Part 1:
 
Workflow for part 1 :
 
part 2:There is no slippery floors now. The route was limited by it, but now there are too many routes to use the simple way.
So I tried to compress the route. The way is to find the nodes that have intersection that can go 3 or 4 direction. It took much time to find this way.
 
After that, I need the steps of each edge. To get them, I made the macro.
And then I did the BFS.
 
 
Workflow for part 1 and 2:
 
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
A check of the input data revealed that each branch had a direction. I solved this as a graph problem.
branch macro
 part1 macro
part2 macro
 
 
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
same concept.
part2: find the point have 3 or 4 directions, calculate the steps for them.
then build a similar macro as part 1.
Then get the max value of the result.
workflow
 part1 macro
part2: get path and steps for each cross nodes
part2 find path macro:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@AkimasaKajitani - Thank you so much for posting your solution! I was trying to solve it similarly to you, but was stuck on Part 2.
I was doing a weird thing where I started at Start and then each time I hit a node point, I split that into a new iterative line and then was only checking to see if the new points at the end were the same. I was ending up in these weird infinite loops and I couldn't get any good data out.
Your way of solving it where you ran all the node points through at once was so much smarter. That, plus your Contains instead of my exact match solved my issue with the infinite loops.
I also like how you did the Generate Rows to create the points to the left, right, above, and below. I was doing 4 Formula Tools and then Unioning the results, which worked, but your way is way cooler.
