Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

General Discussions

Discuss any topics that are not product-specific here.

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

estherb47
15 - Aurora
15 - Aurora

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 - 

EstherB47_0-1577124766736.png

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.

EstherB47_1-1577126452199.png



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:

EstherB47_3-1577127482218.png

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!

EstherB47_4-1577128060614.png



Cheers!

Esther

4 REPLIES 4
patrick_digan
17 - Castor
17 - Castor

@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:

patrick_digan_0-1585247990769.png

 

 

kelly_gilbert
13 - Pulsar

@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)!
https://github.com/kelly-gilbert/advent-of-code/blob/master/2019-alteryx/AoC%202019-08.yxzp

kelly_gilbert
13 - Pulsar

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.

TerryT
Alteryx Alumni (Retired)

Spatial Tools worked for me! 

TerryT_0-1585934862676.png

 

Labels