General Discussions

Discuss a wide range of topics! Questions about the Alteryx Platform should be directed to the appropriate Product discussion forum.
Alteryx is here to help you solve your biggest data challenges. Read about the new Virtual Solution Center here.

Advent of Code - Base A Style! (Post 8 of 26)

14 - Magnetar
14 - Magnetar

Giving up on the Intcode in challenge 7 because honestly, I'm not understanding the instructions.


So onto 8.....


Day 8 - Space Image Format


0.9 seconds


A fun, non-Intcode challenge! Here we need to decipher messages, given the coordinates of points along "layers"

Puzzle input looks a little crazy - 


But, instructions are clear. We have an image here that's 25 pixels wide by 6 pixels tall, so I need to chunk the data into rows of 150 characters (25*6). Easily done with a Regex Parse tool


For part 1, need to count the numbers of zeros, ones, and twos. Easily done with a Regex_CountMatches function:


REGEX_CountMatches([Field1],"0"). etc.

To get the multiple of the numbers of ones multiplied by the numbers of twos, a simple multiplication works. Sort descending to find the answer.


Part 2 is figuring out the message. Stack up all of the layers. 0 is black, 1 is white, and 2 is transparent. So, whichever is showing in the stack is the color used.

Another Regex parse tool separates each row into individual letters. I love to use the Tile tool to number within a group (Unique value method on the Record ID field). Then a summarize tool finds the first position of each 0, 1, or 2 within each position in the layers. Next, filter out the transparent values (where Field1 = 2). Sort and pick out the first character (a 0 or 1) in each position in the message. There are 150, which checks out with 25*6. Now rebuild the picture with a Make Columns tool. Sometimes I prefer this to Crosstab. Here's the configuration:


Added a Browse, and realized this was REALLY hard to read. Decided to replace 0s with empty values, and 1s with #s. Added a Table tool (massive props to @CharlieS for sharing his vast knowledge of Reporting tools with our community!!) with a fixed width of 1". And voila!




15 - Aurora
15 - Aurora

@EstherB47 Sorry for posting 3 months later, but several folks posted heatmaps in this week's challenge (208) and it made me realize that it would work for this as well. My chart output is now readable:




11 - Bolide

@patrick_digan - what did you use for your original day 8 solution?


I used a heatmap (interactive chart tool) for my day 8, so I'm wondering about the other option(s)!

11 - Bolide

Never mind - I went digging around on github and saw that you used a scatterplot!


It's actually kind of cool, because it reveals the letters with negative space, but you're right - the heatmap is definitely more readable.


Spatial Tools worked for me!