TL;DR

I managed to get past puzzle 6 in Advent of Code, 2018 edition.

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.

I think Philboyd_Studge got it right in the card of this python solution:

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:

After all, it gave back some fruits.

Stay safe!