Discussion thread for day 11 of the Advent of Code - https://adventofcode.com/2023/day/11
A nice, tiny break from making iterative macros!
In other news, my efforts/desire to limit the number of tools I slap on the canvas is going the same way as my efforts to reduce the number of cookies I'm consuming this season: not particularly well. I'll pick up on both of these things in the new year 😅
Hello Manhattan distance my old friend!
This runs in a few seconds on my machine - so I didn't spend too much time optimizing
Solution:
A few things help here:
I was a bit lazy – and built 2 macros for the bulk-out, one to move rows, and one to move columns – but it was less brain tax.
The prep macro is a little more complex – it splits out rows; columns to make downstream processing easier
The Bulk-out macros:
I suspect I could have done this better – but this goes through each row which is empty from the largest to the smallest, and shuffles them downwards. This way you can iterate from the end. If I had spent more time on this – there is probably a non-iterative solution, but this runs lightning quick already.
Very much enjoyed this challenge. In years past, the "shortest distance" challenges didn't make sense. This one did, and I'm thrilled that my part 2 runs in .3 seconds!
Straight math, no macros, no spatial. I do wonder if you could spatially match points to a line, maybe with a buffer or trade area, and count the number of points to take a spatial approach. Don't have the energy to poke through workflows to see.