Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

General Discussions

Discuss any topics that are not product-specific here.

Advent of Code 2022 Day 11 (BaseA Style)

AlteryxCommunityTeam
Alteryx Community Team
Alteryx Community Team
Discussion thread for day 11 of the Advent of Code - https://adventofcode.com/2022/day/11
15 REPLIES 15
grossal
15 - Aurora
15 - Aurora

Today was the first day that I gave up getting up at 5 am and tried the challenge with a good night's sleep. Before tackling the problem, I looked at the stats of the fastest solvers and saw, that the best approaches from the speed kings range between 1-3h. When reading the problem, I realized what they must have done and decided: Let's go simple. No double iterative macros, no iterative / batch combination. Let's analyze the problem and go for just one iterative - but very manual - non-scaling macro. I will go to hell for it and will definitely come back to it in the future and go for the double iterative + batch macro solution - I simply wasn't in the mood today and treated it like a one-time consulting question: You need to get the answer, no matter how and you need it fast. 

 

Spoiler
grossal_0-1670755688143.png

 

Macro

grossal_1-1670755718580.png

 


Part 2
I think similar to everyone, I tried to simply increase the data type for part 2 to Int64 and afterward to FixedDecimal 50.0. Obviously, it failed, but it was worth a try. When thinking about it more carefully, I thought about last year: It had to be a mathematical solution, and there had to be a clever way to do it. I did the first iteration for the Monkey 0 on paper and simplified the problem. I spend roughly ten minutes trying an approach that would get rid of my part 1 macro entirely and replace it with a single formula but realized, I'm not JB and still not fully up. Attempt 2 was more successful and required only smaller changes to my part 1 macro - so small, that the whole macro is still exactly the same on the screenshot. For everyone working on part 2 and looking for help here: Take the sample they provide and work through it on paper and look for a mathematical pattern.

 

AkimasaKajitani
17 - Castor
17 - Castor

Too many loops for Part 2!!!

 

Spoiler
In part 2, it took about 3 minutes for 10,000 loops(certainly, the number of loops is 8 x 10,000 = 80,000 loops).
But the time that took the best ratio is how to solve the overflow problem. As a result, I read the reddit and then finally I went to the route using LCM. And also, I mistook the number of monkey in the inner macro... I missed that I set the number of the loop directly.

AkimasaKajitani_0-1670761552426.png

 




Macro for Part 1:
Innter Iterative macro :
AkimasaKajitani_1-1670761629058.png

 


Outer Iterative macro
AkimasaKajitani_2-1670761655644.png

 


Macro for Part 2:
Inner Iterative Macro
AkimasaKajitani_4-1670761720561.png

 



Outer Iterative Macro
AkimasaKajitani_3-1670761694801.png


 

patrick_digan
17 - Castor
17 - Castor

Not pretty today but got there without too much trouble.

Spoiler
Workflow:
patrick_digan_0-1670762181760.png

Macro:

patrick_digan_1-1670762221767.png

 

DawnDuong
13 - Pulsar
13 - Pulsar

I initially misunderstood the question's counting mechanism but eventually figured out my mistake(s).

Otherwise, part 1 is not too difficult.

For part 2, I did not realise at first that there was an overflow issue and even went so far as to built and Excel simulator to debug my workflows. Once figured out that it was an overflow issue, then I solved it with a mathematical formula (hint: Smallest Common Multiplier) to reduce the dimension.

My solution involves using 2 iterative macros. On my laptop, it takes ~10min to run... and we are only D11...😂

Spoiler
Main flow
DawnDuong_2-1670765610558.png

 


Iterative 1: Go through one monkey at a time. The pink and yellow containers include the logic to solve part 1 or part 2.
DawnDuong_1-1670765001714.png

 


Iterative 2: Go through one round at a time. All the extra inputs and outputs are there to help with the debugging...
DawnDuong_0-1670764978241.png

 

bflick
8 - Asteroid

My parsing is still really ugly. Bummed I worked from 12pm-5am called it a night running in the background for part 2 to finish at 6am.

 

Spoiler
Main (Need to clean up the parsing)
bflick_0-1670768783549.png

 



Macro Wrapper (Rounds)
bflick_1-1670768802267.png

 


Macro Inner (Logic)
bflick_2-1670768820559.png

 

Jean-Balteryx
16 - Nebula
16 - Nebula

Day 11 done ! 

 

I used some help for the mathematics because I couldn't figure it out on my own. Besides that, I built something terribly inefficient using nested iterative macros.

 

Workflow

 

Spoiler
Capture d’écran 2022-12-11 à 18.10.24.png

 

Macro 1

 

Spoiler
Capture d’écran 2022-12-11 à 18.10.38.png

 

Macro 2

 

Spoiler
Capture d’écran 2022-12-11 à 18.10.52.png
mmontgomery
10 - Fireball

Took a bit for P1 to figure out, but framework set up P2 was set. Just needed integer overflow fixed with mod function in spoiler

 

Spoiler
Mod([Initial_Result],9699690)
mmontgomery_0-1670782362065.pngmmontgomery_1-1670782399638.pngmmontgomery_2-1670782418881.png

 

.  

LiuZhang
9 - Comet
Spoiler
WorkflowWorkflowInner macro - for each Round, each MonkeyInner macro - for each Round, each MonkeyOuter Macro - for each RoundOuter Macro - for each RoundPart 2 trick, still preserve divisibility checkPart 2 trick, still preserve divisibility check

Well, got some heads up from others, part 2 become a bit more manageable.

patrick_digan
17 - Castor
17 - Castor

It's NOT BaseA, but my version of the Abacus can solve part 2 in 20 seconds without a macro.  Now that i've gotten used to it, I find it easier to solve this way than an iterative macro. 

Spoiler
To oversimplify, I just used my normal solve and used the VarNum and VarText functions to read and write the data in certain spots. The Generate Rows is pretty cool, it's condition expression is actually being updated in the next formula tool. The VarNum/VarText actually allow data to flow backwards (in a sense).

Workflow:
patrick_digan_0-1670787424220.png

Generate Rows (It's reading a variable that is being update in the following formula tool).

patrick_digan_1-1670787466994.png

Some of The VarNum/VarText Formulas:

patrick_digan_2-1670787608980.png

 

 

Labels