General Discussions

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

General Discussions has some can't miss conversations going on right now! From conversations about automation to sharing your favorite Alteryx memes, there's something for everyone. Make it part of your community routine!

Advent of Code 2020 - BaseA Style (Day 8)

Jean-Balteryx
13 - Pulsar

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

AkimasaKajitani
14 - Magnetar

Day 8!

 

Part 1 is simple, but Part 2 is too slow to search the result.

 

Part 1 is an Iterative macro and Part 2 is a Batch macro.

Spoiler
After the getting the stars, I improved the workflow a little.

Workflow:
AkimasaKajitani_0-1607439390512.png

Iterative Macro:

AkimasaKajitani_1-1607439415210.png

 

Batch Macro:
AkimasaKajitani_2-1607439429339.png

 

 As anonymous user #1105310

patrick_digan
16 - Nebula
16 - Nebula
Spoiler
Iterative for the first part and then just duplicated the data for the second part so that way it's pretty fast still (4.4 seconds for parts 1 and 2). Similar to intcode last year, I just stuff the input into a single long string with everything spaced appropriately so that I can get objects based on position. I was using a lot of macro outputs to debug...
patrick_digan_0-1607441410340.png

patrick_digan_1-1607441430219.png

 

NedHarding
7 - Meteor

I was very happy that I managed to solve it without any macros!  They are such a pain to debug, if you can avoid them its always good.

 

Spoiler
NedHarding_0-1607441544693.png

https://github.com/NedHarding/Advent2020/blob/main/Day8.yxmd

 

Balders
10 - Fireball

@NedHarding you're a madman but those multi row formulas are excellent.

Greg_Murray
12 - Quasar

Part 2 was tough for me. I ended up rebuilding and simplifying my initial iterative macro in order to solve part 2.

 

Spoiler
Greg_Murray_0-1607445574705.png

iterative

Greg_Murray_1-1607445622038.png

Batch

Greg_Murray_2-1607445688873.png

 

 

cgoodman3
12 - Quasar
12 - Quasar

Solved part 2 without needing to do it with a batch macro by generating the rows for each of the 300 versions of the model input that are needed.

 

Same concept for the iterative macro for both parts, just a small tweak on part B so it exits when a solution is found.

 

Spoiler
cgoodman3_0-1607447244450.png

Macro for Part B with the break when total records < records in previous step i.e. a solution has been found.

cgoodman3_1-1607447369707.png

 

 

 

Chris
Check out my collaboration with fellow ACE Joshua Burkhow at AlterTricks.com
aguisande
13 - Pulsar
13 - Pulsar

Sorry, no head for part 2 today.

Spoiler
aguisande_0-1607449118582.png
aguisande_1-1607449159109.png

 

patrick_digan
16 - Nebula
16 - Nebula

Just for fun, I can generate rows and then do most all of the work in 1 formula tool using the Alteryx Abacus (non-BaseA). It's pretty fast.

patrick_digan_0-1607453377647.png

patrick_digan_1-1607453451872.png

 

NicoleJohnson
14 - Magnetar
14 - Magnetar

I DID IT!! I figured out how to do this one without macros!!!!! Now to be fair, I solved it the hard & painful iterative-macro-within-an-iterative-macro way last night when I was trying to get stars... but then I spent all night not sleeping thinking there had to be a better way, and lo and behold, IT WORKED. 

 

First solution (runs both parts in 30+ minutes, + Iterative Macro Inception):

 

Spoiler
Relatively simple workflow, relatively un-simple macros... though the first time I've used the automatic text input tool for AoC, courtesy of @NedHarding - thank you for the instructions/macro for this magical input option, Ned!! Day8.JPG
Part 1 macro (which is also used in the Part 2 macro) - I'm not even sure at this point what it is doing, but has something to do with updating the value & the next instruction number for each iteration. And probably some extraneous inputs that are no longer needed... it was like 11:30pm by the time I finished, and I never want to see this thing again.
Day8_Macro1.JPG
Part 2 macro, which will run the selected jmp/noc replacements through the Part 1 macro. Took about a half hour to run on my server - was shaping up to take 5 or 6 times that long on my laptop. I made it an iterative macro because it was slow and I wanted it to stop running the first time it ran into a scenario where it completed, rather than running ALL scenarios, potentially unnecessarily. I sort of hate this solution... but it worked, so there's that.
Day8_Macro2.JPG

   

Second solution (Runs both parts in ~26 seconds + NO MACROS):

 

 

Spoiler
By combining the instructions into a single standardized pattern and then using a goofy but quite functional Substring+RegEx_Replace Multi-Row Formula, this ended up being extremely efficient and so much simpler to understand (and modify in future challenges, probably) than the macro-inception route above! I think I could make this work for running Part 1 & 2 at the same time with some tweaks to the post Multi-Row tool logic, a la Ned's approach that I see is sans macro as well - the Multi-Row formula tool is exactly the same for both parts, with the exception of grouping by Batch ID in Part 2. 

Day8_NoMacros.JPG

Is BootCode the new Intcode? BRING IT ON.

 

Cheers!!

NJ

https://github.com/AlteryxNJ/AdventOfCode_2020

EstherB47
14 - Magnetar
14 - Magnetar

Definitely not winning tool golf here. And I love @NicoleJohnson 's method of putting the row skipping and accumulator into one tool. For my brain, worked better in 2 multirows. Plus I added another multirow tool to see if codes repeated because I hated that the unique tool sorted the data and then I had to sort again to get back into order.

 

23.1 seconds. No macros. Take that, Intcode nightmares!!!  Part 1 only took .7 seconds, which amazed me.

 

Credit goes to @patrick_digan 's method of concatenating and replacing pieces of code from last year. Worked like a charm.

 

Spoiler
EstherB47_0-1607480687133.png