General Discussions

Discuss any topics that are not product-specific here.

Advent of Code 2021 Day 3 (BaseA style) - Binary Diagnostic

jdunkerley79
ACE Emeritus
ACE Emeritus

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

18 REPLIES 18
bflick
8 - Asteroid

They're definitely starting to ramp up. Had a lot of fun with this one. 

Spoiler
Challenge 1:
Parsed out each character into a column with regex. Transposed and took the mode of each column (Gamma). Took the opposite of the mode to get Epsilon. Used bin to int to get the numbers.
Challenge 2:
Built an iterative macro to loop through each column of characters. Used a join as a filter for identified modes. I got tripped up by the if the same amount of 0s and 1s piece, so built in a test in the macro to solve it.
Workflow:
Day 3 - Workflow.jpg
Day 3 Macro:
Day 3- Macro.jpg

cgoodman3
14 - Magnetar
14 - Magnetar

Note to self: Must not make assumptions!

 

Spoiler
Workflow:
cgoodman3_0-1638511985216.png

Macro:

cgoodman3_1-1638512038114.png

The macro essentially follows the same process as the main workflow to identify the most common value (1,0) at each bit position, but uses a substring expression to move along the string to find that iterations' most common value and then filters it out. Repeating the pattern until there is only one row left and converts to int.

It was handy to recall the BinToInt() function from previous years otherwise I would have manually converted things like 10100 to 20!

 

Chris
Check out my collaboration with fellow ACE Joshua Burkhow at AlterTricks.com
cgoodman3
14 - Magnetar
14 - Magnetar

@bflick I like your part 1 solve as it’s nice and simple and makes sense that epsilon and gamma are anti versions of each other. I’m going to tell myself that I took the long route for part 1 as I knew it would come in handy for part 2;)

Chris
Check out my collaboration with fellow ACE Joshua Burkhow at AlterTricks.com
NicoleJohnson
ACE Emeritus
ACE Emeritus

I will admit the solutions that got me the stars was not my best work... but I went back after the fact and cleaned it all up with a much more straightforward solution that was actually very similar to @bflick !

 

Spoiler

I'm far too mortified of my first solution to post it here, so this is the nicely cleaned up version after I had time to think through a better strategy. 

NicoleJohnson_0-1638514649071.png

And the macro to do the Part 2 part (I had two separate macros the first time, since I didn't want to waste time figuring out how to get the same iterative macro to do both the CO2 Scrubber part and the Oxygen Generator part... happy to say I did find a way to do so eventually!) Oxygen Generator does the same thing as CO2 Scrubber section, just for the alternate column.

NicoleJohnson_1-1638515212749.png

 



I'm sensing a binary theme so far this year? Definitely getting more traction out of all these sweet binary formulas in Alteryx than I have EVER used them before!! 

 

Cheers!

NJ

afv2688
16 - Nebula
16 - Nebula

Third day finished 🙂 much more interesint this one than the first two to be honest

 

Untitled.png

OllieClarke
15 - Aurora
15 - Aurora

Think I might have used too many joins...

Spoiler
OllieClarke_1-1638526736599.png

 


OllieClarke_0-1638526699970.png

 

OllieClarke
15 - Aurora
15 - Aurora

@bflick Nice solution! I always forget that mode is an option....

Aguisande
15 - Aurora
15 - Aurora

Ok, now we are talking... took me longer than I thought

Spoiler
Aguisande_0-1638539028344.png

 

Aguisande_1-1638539314327.png

Thank you Detour Tool!

patrick_digan
17 - Castor
17 - Castor
Spoiler
Part 1 was simple enough, but part 2 took a little bit longer to put the iterative macro together.
patrick_digan_0-1638544514880.png
patrick_digan_1-1638544552801.png

 

 

Labels