General Discussions

Discuss any topics that are not product-specific here.

Advent of Code 2023 Day 18 (BaseA Style)

AlteryxCommunityTeam
Alteryx Community Team
Alteryx Community Team

Discussion thread for day 18 of the Advent of Code - https://adventofcode.com/2023/day/18

17 REPLIES 17
Qiu
20 - Arcturus
20 - Arcturus

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.

Spoiler
AOC2023-Day18-01.pngAOC2023-Day18-02.pngAOC2023-Day18-03.png

 

mmontgomery
11 - Bolide

Got P1 thanks to D10 process! P2, well, that will take some time

Spoiler
I generated each point possible based on min/max column row.

Did a spatial match based on the polygon to that route.
D18P1_Main.pngD18P1.png
DataNath
17 - Castor

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!

 

Spoiler
Day18P1.png
phottovy
13 - Pulsar
13 - Pulsar

My solution which runs in about 1.5 seconds for both parts.

 

 

Spoiler
For P2, I got some help from the subreddit to relearn some basic geometry. It was pretty straightforward after that.

18.png

Macro:
18_Macro.png

 

 

AndrewDMerrill
13 - Pulsar

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....

ScottLewis
8 - Asteroid

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. 

Qiu
20 - Arcturus
20 - Arcturus

@phottovy 
Thats crazy. 😁
Maybe you can share the geometry lesson again? 🤣

phottovy
13 - Pulsar
13 - Pulsar

@Qiu, I'm happy to share some hints.

Spoiler
I didn't know the answer myself but the subreddit pointed my to the shoelace formula. That link does a pretty good job of simplifying the concept.

Brief hint #1:
Spoiler
As long as you know the end points of your polygon in either a clockwise or counter-clockwise direction, then you can calculate the area inside the polygon.
Brief hint #2
Spoiler
This formula in that link got me close to the final answer but it wasn't all the way there. I then had to make sure I included all of the points on the perimeter of my polygon to the area calculated using the shoelace formula.
Pang_Hee_Choy
12 - Quasar

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#

Spoiler
Bing AI give me Shoelace formula - Wikipedia
which generate the area, and it not same with example given.

then reddit said use that for another formula Pick's theorem - Wikipedia
still no clue till running one of the python code.

key#
Spoiler
b is sum of point of boundary of the shapes
notes: try with part1 example. it easier and similar.
Labels