General Discussions

Discuss any topics that are not product-specific here.

Advent of Code 2023 Day 8 (BaseA Style)

AlteryxCommunityTeam
Alteryx Community Team
Alteryx Community Team

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

26 REPLIES 26
gawa
15 - Aurora
15 - Aurora

I feel "Day5 comes again!". I created WF that I will never look back again😂

Spoiler

image.png

 

DaisukeTsuchiya
13 - Pulsar

Part2 was tough again. 

Spoiler
Part2 never finished by macro with normal approach. 

I got some hint from @AkimasaKajitani san and @gawa san otherwise I would never reach to the results.
Excel will be much easier for last container process.

<WF>
スクリーンショット 2023-12-08 172713.png
<Macro Part1>
スクリーンショット 2023-12-08 172748.png
<Macro Part2>
スクリーンショット 2023-12-08 172818.png

AndrewDMerrill
13 - Pulsar

Today was terrible... very challenging, wasted a lot of time expecting a large answer for Part 1, so I wasted an extra couple hours there. I did finish though, which is good. I also learned a few things along the way, which is even better!

Spoiler
Main Workflow:
Main Workflow.png
Path Calculating Iterative Macro:
Search Path Macro.png
Lowest Common Multiple (LCM) Calculating Iterative Macro:
LCM Macro.png
Greatest Common Factor (GCF) Calculating Iterative Macro:
GCF Macro.png

 

cgoodman3
14 - Magnetar
14 - Magnetar

Workflow - Day 8Workflow - Day 8Macro for part 1Macro for part 1Macro for part 2Macro for part 2

- Simple parsing.

- Part 2 macro is an update on 1, to do a join and amend the logic to search for ending letters.

- Needed to use other methods *cough* to find the LCM but knew that was the approach so looped through each starting value, but should really have put this in a batch macro. So will need to check out @AndrewDMerrill LCM macro.

Chris
Check out my collaboration with fellow ACE Joshua Burkhow at AlterTricks.com
patrick_digan
17 - Castor
17 - Castor

my last bit for part 2 isn't dynamic, and thank goodness for AMP which went much faster.

Spoiler
 

image.png

 

image.png

mmontgomery
11 - Bolide

P1 was easy enough brute force. P2 in spoiler

Spoiler
For P2, I figured brute force would take way too long. After doing AoC for some time, I've learned that exceptionally large numbers and paths generally have a pattern over time. It took me a long time to think about an approach but landed on this:

For one 'A' route, let's get 100k records in order and see if there's a pattern in paths. It turns out, that, yes, there is: not only does this A route always go to the same Z route, it goes there in the same number of steps!

Once I figured that out, I just did the same for the other 5 'A' inputs and got the route path number.

Once I got the six numbers, I took the LCM of the six values!
Day8.pngDay8_Macro.png
kelsey_kincaid
12 - Quasar

Interesting puzzle! Frustrating to solve, but I learned a lot :)  This takes longer to run than I would like, but it's manageable.

I'd actually love to revisit this one sometime when I'm fresh to optimize my approach. Lots of food for thought with this puzzle without completely wrecking my brain like Day 5 did.

 

 

Spoiler

Part 1: Brute force. Traverse every node based on the input directions until I hit ZZZ. Used an iterative macro.

I was proud of my formula to evaluate which direction to follow for each iteration: Mod([Engine.IterationNumber],Length([Source_data]))

Macro:
D8P1.png

Part 2: Per usual, I tried to brute force this and felt really good about my logic... until I saw it creeping up to 500k iterations. It was sometime around then that I not only knew there had to be a mathematical solution, but that I'd have to figure it out in order to solve the puzzle. This workflow would never finish running otherwise.
After some rubber ducky debugging, I remembered something about Least Common Multiples from elementary school math and went to work. This is, I'm sure, far from the most efficient solution, but here's how I did it:

  • Iterative Macro to take a single node ending in A and find how long it takes to get to Z. Fairly similar to part 1.
  • Wrap that iterative macro in a batch macro, so that it'll find the length to a Z for each individual node ending in A.
  • Generate every number from 2 up until the path length for each node and evaluate if the path length was divisible by the generated number. I could have skipped even numbers, but then my sample data didn't work which bothered me. This brought me to two factors for each path (convenient), one of which was actually the length of the string of directions. 🤔
  • Multiply factors to find least common multiple, and input that as my answer for Part 2

 

Batch Macro:

D8P2 - Batch.png

 

Iterative Macro:

D8P2 - Iter.png

 

Whole Workflow:

D8 WF.png

 

 

 

alisonpitt
11 - Bolide

I'm still finding AoC fun but it's getting a little wild! Part 2 had me researching math algorithms...

Spoiler
Part 1Part 1Part 1 macroPart 1 macroPart 2Part 2Part 2 macroPart 2 macro

Special thanks to @estherb47 for an old thread on [redacted]

DataNath
17 - Castor

Day 8 done! Part 1 and 2 macros look so different as I had stupidly been generating the instructions within the iterations for part 1 and changed that for the second part. Like others, I just ran each 'A' instance one-by-one using a batch macro that wrapped the path iterator, then took the LCM for the answer. A very fun one today!

 

Spoiler
Day8WF.png

Day8.1Iterative.png

Day8.2Batch.png

Day8.2Iterative.png
Labels