Wow, that was tough. Cool challenge though! I realized during WC95 that you can graph numbers with the spatial tools, and I appreciated using that to check my work.
Today's challenge is tough, too.
Macro
GitHub
https://github.com/AkimasaKajitani/AdventOfCode/tree/main/2021
Second part is tough, had some tips on using spatial correctly.
Wow wow wow. Really had trouble wrapping my head around part 2 of this one. Thank you, @grossal for helping me translate what I wrote down on my graph paper into Alteryx tools!
@starkey, this is an amazingly clean solution. As much as I like the spatial tools in Alteryx, this is cool.
thanks!
I spent too long on the first part. I kept getting the wrong answer and couldn't work out what the issue was. Original plan was to use multi-row but added to the fact I wasn't getting the logic as I expected, I didn't like this approach as it wasn't easy to switch between example and input, for example needing to code +/- 10 and 100 respectively.So I ended up building out the logic in a more structured way with joins to find the up, down, left, right positions.
For part 2 it was much quicker building out an iterative macro finding the nearest point for each low point and working outwards from that until you hit the wall of 9's.
Then just because I can't get enough of AoC I thought there would be a spatial solution to this.
So for each point created a trade area (without overlaps) and then removed the points with a depth of 9. This then left me with needing to create combined polygons for these points and I recalled how @jarrod used Make Groups in the Grand Prix in 2020.
I like this approach as you get a nice visual representation of the basins.
It's only after posting that I notice that @clmc9601 did a similar approach using make groups as the first poster of the day! 👏👏👏