General Discussions

Discuss a wide range of topics! Questions about the Alteryx Platform should be directed to the appropriate Product discussion forum.

Advent of Code 2021 Day 14 (BaseA Style)

jdunkerley79
16 - Nebula
16 - Nebula

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

 

 

33480c3d-16ee-4b01-80c0-35c85f2a7d9f.jpg

16 REPLIES 16
patrick_digan
16 - Nebula
16 - Nebula

and for my non-macro solution!

Spoiler
I stole a page out of @danilang 's book and just have a rather lengthy multi-row formula tool that is looking back at the previous rows...200 of them! haha so it's not entirely dynamic in that you'd have change your MR Formula depending on your data. I only needed like 170 rows for my data, so I just did 200 to add some margin. And I did use excel to create that formula. It still processes in a second or 2.
patrick_digan_2-1639537768812.png

 


 

Here's where the magic happens, something like 23,000 characters in that Multi-Row Formula tool checking the prior 200 rows:
patrick_digan_1-1639536993239.png

 


  
estherb47
15 - Aurora
15 - Aurora

Also started off with a macro that worked beautifully for the first 10 iterations, but grinded to a halt at around iteration 23.

Thanks everyone for the suggestion of looking only at the pairs of letters and their resulting new letters. Once I wrapped my head around how to solve, building the macro was pretty easy.

 

Spoiler
estherb47_0-1639544478500.png

 

AkimasaKajitani
15 - Aurora

My brute forth macro was failed...

Community member's tips helped me a lot!

 

Spoiler
AkimasaKajitani_0-1639585051043.png



Brute forth macro for star1

AkimasaKajitani_1-1639585078886.png

Macro for star2 using Community member's Hint!

AkimasaKajitani_2-1639585091262.png

 

 

GitHub

https://github.com/AkimasaKajitani/AdventOfCode/tree/main/2021

SeanAdams
17 - Castor
17 - Castor

Like everyone else - I first started with brute-force build-out of the full string.

But the 40 iteration run crashed Alteryx - the string is too long for Alteryx strings.

 

Also - note the super-cool Pairs icon for this macro

 

a-pair-of-pears.jpg

 

Spoiler
Recipe:
- Keep track of the pairs - manage the sets of pairs rather than the full string
- To figure out the counts of the individual characters - just split up the pairs; then add the first and last character - then divide the counts by 2.

SeanAdams_1-1639622286588.png

 

And here is the pairs macro
SeanAdams_2-1639622336677.png

 


 

NicoleJohnson
14 - Magnetar
14 - Magnetar

Ahhhhh finally got Part 2!! Took several days of noodling on it, and scrolling through tips from Community + ACEs (I think @afv2688 was the first to point me in the right direction, THANK YOU!!), but it finally clicked.

 

Spoiler
Counting pairs is so much more fun than bajillion character length strings. 

NicoleJohnson_0-1639794233577.png


Part 1 Macro:

NicoleJohnson_1-1639794264628.png

Part 2 Macro:

NicoleJohnson_2-1639794290529.png

 

I find it incredibly interesting that, with the possible exception of the interface/macro tools, 95% of these AoC workflows can be solved with the basic tools in the Favorites category. So powerful!!

 

Cheers!

NJ 

Pang_Hee_Choy
10 - Fireball
Spoiler
Thank for inspire to group it up.

take few hours to compare with part 1 macro.

Pang_Hee_Choy_0-1640054796701.png


for counting it take either one letter of original pair and the new letter, and do not forget to add back the last digit.

Pang_Hee_Choy_1-1640055023645.png
join to get 2 new pair, and then use arrange to by pair with count, and sum it up.




caitlynmcintyre
8 - Asteroid

Like everyone else my macro for Part 1 could not compute for Part 2 due to not having a super computer, so I had to pivot and thankfully it worked very well

 

Spoiler
My macro simply takes all the pairs, maps them to the new character and then makes two new pairs, one with the first character +inserted character, second with the right hand character+inserted character.

Group by pairs and outputs a count and then send it back through again.

caitlynmcintyre_0-1640136526297.png

Macro: 

caitlynmcintyre_1-1640136672041.png