ETOOBUSY 🚀 minimal blogging for the impatient
And, to be honest, I’m not entirely happy with the solution.
I mean, I got past so my solution is correct. But… it’s a solution to my inputs, not a generic one. It’s also very messy.
One tricky part is that some of the areas can go to infinity and one has to be careful to… avoid them. So I was stuck for some time trying to figure out a way to represent the field in order to avoid doing too much calculation… but I ran out of ideas so I eventully conjured up something and hammered it until it gave the correct answer back.
Rules for raising a programmer: never feed it after midnight, never get it wet, and never give it anything involving the word ‘infinite’
It was dirty and did not leave me with a generic solution, which is a shame.
On the bright side:
- … it was fun!
- … part 2 was easier and led me to Today I Learned: Portable Grayscale Map.
- … I was reminded that I still have to properly address Voronoi diagrams;
- … I realized Voronoi diagrams with Manhattan distance are nothing like their counterparts with the Euclidean distance;
- … I discovered, in particular, that the points “going to infinite” are NOT the vertices of the polygonal Convex Hull of the set of points, especially if you consider the Euclidean distance to calculate it!
After all, it gave back some fruits.