Advent of Code 2018, puzzle 6: get the job done!

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!


Comments? Octodon, , GitHub, Reddit, or drop me a line!