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 2021 Day 24 (BaseA Style)

jdunkerley79
ACE Emeritus
ACE Emeritus

Discussion thread for day 24 of the Advent of Code - https://adventofcode.com/2021/day/24

5 REPLIES 5
patrick_digan
17 - Castor
17 - Castor

I just used google sheets, but it was basically a pen and paper solve trying to figure out the pattern. After I figured out the solution, I could have used alteryx to process and verify that z indeed comes out 0 (but I didn't bother). 

Pang_Hee_Choy
12 - Quasar

pen and paper. and some information from Reddit.

Spoiler
1. summarise the step for every input. we will found they only have 2 pattern.
2. manual change until Z = 0 (ensure all mod is true)
3. pair them up. it have one row will change when other is change.
4. find the max, then you will find the min (part 2)

Pang_Hee_Choy_0-1643603100072.png

 

Pang_Hee_Choy
12 - Quasar

here the workflow. it take 7-10mins to output.

Spoiler
it iteration. just expand 1 to 9 for every input.
to reduce the list.
in every type 2.and input "eql x w", keep x=1. 

i got an idea for reduce time spent, by re-structure the input data. (i.e. 2-6 loop between every input w)


Pang_Hee_Choy
12 - Quasar

update: workflow within 10 seconds.

Pang_Hee_Choy_3-1643622799205.png

Spoiler
after reduce 252 steps to 14 steps. the time is decrease significantly.


1. generate 1 to 9 as usual.
2. for type 1, [z]*26+[y]
    for type 2, if mod([z],26)+[x])=[w] then floor([z]/26 else remove.
3. iteration until id = 14 and [z] = 0

the 14 line.

Pang_Hee_Choy_1-1643622683035.png

macro:

Pang_Hee_Choy_2-1643622762922.png

 




 

SeanAdams
17 - Castor
17 - Castor

I didn't get this to be as simple as @Pang_Hee_Choy , but close.

The trick for this one is reading the code provided by the challenge to find the pattern in it.

 

Spoiler
If you read through the code provided - there's a recurring pattern.
Once you decode this - there's just 14 simple iterations

SeanAdams_0-1644624904932.png

 


Along the way - also built an interpreter that interprets the instructions one by one using dynamic replace

SeanAdams_1-1644624993281.png

 




And this one brings it all together:

SeanAdams_2-1644625102653.png

 

Labels