Discussion thread for day 18 of the Advent of Code - https://adventofcode.com/2023/day/18
Finally completed Part 1 and I am convinced that Part 2 is beyond my reach... 😂
But it really feels good when looking at the output.
Got P1 thanks to D10 process! P2, well, that will take some time
Part 1 only for today - need to have a think about how else I can approach P2 as using the same method here ends up generating over 300 billion rows!
My solution which runs in about 1.5 seconds for both parts.
This problem is crazy! Part 2 became my white whale as I struggled to wrap my mind around what was going on. I'm cleaning up my workflow now, I have an idea that will simplify things greatly. My current workflow is too long to post a screenshot of....
First one in a while that has felt good. I've been able to do most of them but it felt like a hack but this one with the algorithm in place is .4 seconds to do part 2 no macros just multi-row formulas. There is probably more elegant way to handle next(last) = first but this does the job.
xymd has the remains of my original build path and fill solution to part 1, which worked but would not have run part 2 during the remainder of human civilization.
@phottovy Thats crazy. 😁Maybe you can share the geometry lesson again? 🤣
i ask bing AI for this question. it gives me some clues but still have to go to reddit for more idea.
luckily learn some python, and the code is explained well.
hint#
@PangHC @phottovy I was looking at the Shoelace formula and the Pick's theorem seems to be more easier.It turns out to be mathmatical problem. 😂
I try to find the calculation method using excel but finally followed other's idea.
Well, my first thought was "this looks a lot like day 10", so started in with a spatial approach.
While this worked, it took about 2.5 minutes to run. I did learn fun things about generating integer points and getting them to intersect (have them come from the same stream of data!). But knew this wouldn't be scalable for part 2
Read through solution descriptions, and found the shoelace method.
Runs in 0.5 seconds
Part 1 : I use spatial tools.
Part 2 : The shoelace formula is needed.
This is the final workflow.
I solved P1 and P2 without any hints. I learned the shoelace formula here. It is very smart.
@phottovy - Thanks for sharing. I was so close but forgot to add in the perimeter/steps around the outside - thank you as usual for unsticking me
post workflow.