Discussion thread for day 10 of the Advent of Code - https://adventofcode.com/2023/day/10
Finally caught up on day 10! Really enjoy the challenge of these grid problems and thinking how best to tackle them whilst limited to table structures in Alteryx. Part 1 and 2 macros are very similar - I just added an extra print output of the co-ordinates of each iteration so that I could build a polygon and conduct spatial matching for P2.
Good lord this took me a while
FINALLY got Day 10 done. I was busy on Sunday and missed this and finally had a chance to get it done.
I appreciate @kelsey_kincaid posting their solution. I got to the Spatial Match on Part 2 and wasn't sure what to do with the output :D
I knew I would get to use spatial tools sooner or later! I feel like this is one where Alteryx definitely makes part 2 easier. NOT that it was easy 😅
think of spatial for part2 but no luck, thanks @kelsey_kincaid
Tunnel problems – really allows you to dig into them <wah wah wah>
Part 1 was pretty brute force – and ran in 6:28
Part 2 I gave up on computational approaches (I need to go an look at other people’s solutions) and used spatial – worked like a charm.
😊 oh, and got to use control containers here too!
Details in the spoiler below.
Part 1:
Really just 2 steps:
Find paths macro:
The way this works is that from each current point, you look at where you can move to – if there are no possible moves then exit
The explosion to possible moves happens in the join and in the formula immediately after it
The output of this is a list of all the tunnel pieces (from X to Y) and an engine iteration number. The highest engine iteration number is also the furthest point from the start since it took us the most steps to get there – so the problem is solved.
Part 2:
So – we’re coming into Part 2 with all the tunnel pieces – however I couldn’t figure out a pretty way to computationally see if something was inside or outside the tunnel. I did start by working from the outside edges inwards, but that doesn’t work for the stuff where the rabbit squeezes between the tunnel pieces.
Enter Spatial.
Here’s the recipe:
And why the control container – ‘cause you only want part2 to run when the output from Part 1 completes and the output file finishes writing
thank you for writing this up @AndrewDMerrill - very generous of you to spend the time - and your explanation makes complete sense.
I feel like I cheated a little and used the spatial tools for part 2 - but it is BaseA :-)
great writeup and unique solution - thank you for taking the time @gawa