Summary for those just joining us:
Advent of Code is an annual Christmas themed coding challenge that runs from December 1st until christmas. Each day the coding problems get progressively harder. We have a leaderboard and pretty good turnout, so feel free to hop in at any time and show your stuff!
Whether you have a single line monstrosity or a beautiful phone book sized stack of OOP code, you can export it in a nice little image for sharing at https://carbon.vercel.app
What did you think about today's problem?
Our Code is 2416137-393b284c (No need to share your profile, you have the option to join anonymously if you don't want us to see your github)
Jump in the discussion.
No email address required.
Ended up using pick's Theorem.
Jump in the discussion.
No email address required.
Can you explain how? I saw a bunch of reddit people saying the same thing and I don't understand how that works since you'd need to know the area of the interior to calculate the result. Unless I just don't understand the theorem which is also likely.
Jump in the discussion.
No email address required.
Use a Depth First Search, one item at a time, to get the entire pipe in order. Then use the shoelace formula to get the Area. From picks theorem,
A= i +b/2
where A is the area, i is the number of interior points (the answer to the puzzle) and b is the number of boundary points (the length of the pipe).
The 2nd illustration on the Wikipedia page is very useful. https://en.wikipedia.org/wiki/Pick%27s_theorem
Jump in the discussion.
No email address required.
More options
Context
prpbably spomething to do with the difference of the coordinates
Jump in the discussion.
No email address required.
That doesn't help even a little bit, but thanks I guess
Jump in the discussion.
No email address required.
More options
Context
More options
Context
More options
Context
More options
Context