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 19)

Alteryx Certified Partner

Discussion thread for day 19 of the Advent of Code :

16 - Nebula
16 - Nebula

Regex to the rescue...

As the problem said don't solve the general case for Part 2!

A bit of thinking and then broke Part 2 into 2 blocks which was a lot easier!

The generated Regexes are horrible but work




8 - Asteroid

Surprisingly simple solution in the end after a lot of troubleshooting. It works for both parts and can be turned into a macro-free solution.


Macro solution:


Macro-free solution:



Alteryx Certified Partner

Very similar to the both of you and I think I've made more iterative macros this month than I ever have in day to day Alteryx use!



For part 2 I evaluated for "^[042]+[031]+$" where the [042]+ was longer than the [031]+.

AoC 19.pngMacroAoC 19 Macro.png
Alteryx Partner

Also a "bit" of regex... I used two iteratives: one to generate rule 0 and another to beautify the regex expression (remove extra brackets).

The same workflow works for both parts, after manual update of the rules... It took me a lot of trial and error to get it working for the updated rule 11. But to the rescue. 

Alteryx_Day_19.pngThe updated rules for part II:
rule 8 is the same as (42)+
and rule 11 has a recursive (which took me ages to finally get it working): 


Mixed feelings about hardcoding the new rules--e.g. this would not work for a random rule that has a loop, but:



Final Regex

Alteryx Certified Partner

I'm not sure I understood everything I did about Regex but eventually I got there, discovering recursive regex on the way.


Capture d’écran 2020-12-20 à 00.36.04.pngCapture d’écran 2020-12-20 à 00.37.12.png

Alteryx Certified Partner

@dsmdavid lovely recursive regex I'd have never have worked that out