Discussion thread for day 11 of the Advent of Code : https://adventofcode.com/2020/day/11
Definitely needed a couple hints to get going on this one. It finally clicked when read people were using coordinate based approaches. And as I write this I am realizing I probably could have made use of spatial tools for distance calculations. Oh well... nothing wrong with brushing up on grade school math.
Macro
@Greg_Murray This one was interesting - you can cheat and use 1 dimensional distance. I just #'ed the cells 0 to 9024 and then used abs(a-b) for distance. The absolute distance doesn't matter, only the sort order.
Here's my solution for the first part. Like @Balders there are a lot of tools in the macro to force it to exit when it meets the condition of no seats changing between the iterations.
Macro:
It's late and it's Friday so I'll try and workout part 2 over the weekend.
Tried to edit my post yesterday but it disappeared..
Here's my iterative solution.
iterative to solve 1
iterative to prepare for part 2
iterative to solve part 2
It was really interesting to see the seating iterations develop too!
https://public.tableau.com/profile/petergb#!/vizhome/Day11_16077110205010/AoCDay11
Watching the seats fill up is very satisfying!
So while my original idea of converting to spatial and using find nearest, like many of us did last year, showed promise but was WAY too slow.
Solution to part 1 is probably very convoluted, but it works, and it only takes about 30 seconds for the iterative macro. Not stellar time, not winning at tool golf, but at least it functions.
Part 1 workflow, simple enough
Macro. Ugh. But it works
A week between parts a & b for me as my son came home and busy with work before off for 2 weeks (but not from Alteryx 😃). Could have used the second macro for both with minor changes to workflow.