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 2020 - BaseA Style (Day 14)

Alteryx Certified Partner

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

16 - Nebula
16 - Nebula

Feel like I over complicated part 2 but it works...

Spoiler
jdunkerley79_0-1607942120746.png


Lots more binary

 

Alteryx Certified Partner

Here's me, a nice step down from yesterday's part 2 😅

 

 

Spoiler
In part one I used a really long repetitive formula to avoid the tokenisation stuff you see if part two.

AoC 14.png
Alteryx Certified Partner

Has anyone got a good way of doing "find nth" in a formula. I think part 2 could be simplified if there's an easy string manipulation way of doing "find nth" to search through Xs. 

16 - Nebula
16 - Nebula

@Balders yep - did some dynamic regex to get a new version working. Less tools but slower than old version.

 

Spoiler
jdunkerley79_0-1607947810977.png

REGEX_Replace(
iif([Row-1:memory]="",[memory],[Row-1:memory]),
"^(.{" + ToString(Length(
REGEX_Replace(Mask,"(^([^X]*X){" + ToString(i) + "}[^X]*)X.*","$1")
)) + "})."
,"${1}" + Substring(PadLeft(IntToBin([P]),Count,"0"),I,1))

And used Regex CountMatches to work out how many I needed to run

 

Alteryx Certified Partner

@jdunkerley79 excellent

Alteryx Partner

Not aiming for any golf points today...

Spoiler
Alteryx_Day_14.png

the first part builds the regex for the replacements.
Part II - went iterative as I couldn't figure out how to replace all the potential 'X's.

 

 

https://github.com/dsmdavid/AdventCode2020

Alteryx Certified Partner

Day14!

 

There are a lot of tools, but it's working well.

Spoiler

Workflow:
AkimasaKajitani_3-1607961466832.png

 



Outer Iterative Macro: Iterative is only 36 times.
AkimasaKajitani_2-1607961439421.png

 


Inner Batch Macro: overwrite the Field Name for splitting 0,1 
AkimasaKajitani_1-1607961392053.png

 

 

I have still yesterday's homework...(I don't clear the Day13 Part 2 by only Alteryx)

12 - Quasar

I struggled through part 2, but eventually got there. I think I can chalk it up to not reading the prompt thoroughly. 

Spoiler
Greg_Murray_0-1607962534339.png

 


 

17 - Castor
17 - Castor

Parts 1 and 2.  

 

Spoiler
w.png
I thought I'd have to use a macro to generate the combinations for part 2, but I was able to figure it out using multiple applications of BinaryAnd in the big formula 

Dan