Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

General Discussions

Discuss any topics that are not product-specific here.

Advent of Code 2021 Day 13 (BaseA Style)

jdunkerley79
ACE Emeritus
ACE Emeritus

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

 

 

download.png

9 REPLIES 9
clmc9601
13 - Pulsar
13 - Pulsar

Nice to have a shorter challenge this time!

 

Spoiler
I calculated what the new (flipped) values should be for any coordinates affected by the fold and then used an iterative macro to incrementally apply each fold's logic.

Screen Shot 2021-12-12 at 10.29.44 PM.png
Screen Shot 2021-12-12 at 10.26.31 PM.png
bflick
8 - Asteroid

Took me 30 min to figure out in one of my convoluted formulas I put an X where I needed a Y. Fun solution without an iterative macro.

Spoiler
bflick_0-1639375339641.png

 

cgoodman3
14 - Magnetar
14 - Magnetar
Spoiler
It's so nice to go back to quicker challenges to solve, but oh my! I really struggled with getting my x folds the wrong way around, I kept looking at the output thinking none of these look like letters. It was fine for the input with only one fold where the direction didn't matter.

I copy and pasted the instructions and the dot positions into two inputs, and used the selector macro to choose which input to use.
cgoodman3_0-1639385082675.png


Originally I just did it by brute force for speed as it was only 12 instructions to replicate, however due to my folding error I ended up building a macro to check my answers

cgoodman3_1-1639385154792.png


Using the spatial tools to plot points gets you a nice and easy to read output.

cgoodman3_2-1639385209157.png

 

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

@bflick nice non-macro solve 👍

Chris
Check out my collaboration with fellow ACE Joshua Burkhow at AlterTricks.com
afv2688
16 - Nebula
16 - Nebula

Wanted to be the first non macro 😅 oh well, here it is anyway

 

Spoiler
Untitled.png
AkimasaKajitani
17 - Castor
17 - Castor

Today is iterative day.

 

Spoiler
I made all fold it up at star 1. But it should be made for star2.

AkimasaKajitani_0-1639402081890.png
Macro
AkimasaKajitani_1-1639402107836.png

 

 

GitHub

https://github.com/AkimasaKajitani/AdventOfCode/tree/main/2021

estherb47
15 - Aurora
15 - Aurora

Bizarrely enough, my macro approach failed, so here is a non-macro version.

 

Spoiler
Thinking through the process, you can take a single point, and apply all transformations needed to each point, then move to the next one. So, for the example, there are two transformations. Bring the first point 6,10 through the y change and the x change, and you get 4,4 (change both x and y)

First, generate the number of transformations with a record ID and then the Max record ID, and then use a generate rows tool to generate those amount of transformations for each point.

My multirow formula is admittedly ugly. I didn't want to do separate ones for x and y

Spoiler

IF [Step]=1 THEN
IF [Axis]="x" AND [Shift]<tonumber(REGEX_Replace([Point], "(\d+)\D+?(\d+)", "$1"))
THEN tostring(tonumber(REGEX_Replace([Point], "(\d+)\D+?(\d+)", "$1"))-2*(tonumber(REGEX_Replace([Point], "(\d+)\D+?(\d+)", "$1"))-[Shift]))+","+REGEX_Replace([Point], "(\d+)\D+?(\d+)", "$2")
ELSEIF [Axis]="y" AND [Shift]<tonumber(REGEX_Replace([Point], "(\d+)\D+?(\d+)", "$2"))
THEN REGEX_Replace([Point], "(\d+)\D+?(\d+)", "$1")+","+tostring(tonumber(REGEX_Replace([Point], "(\d+)\D+?(\d+)", "$2"))-2*(tonumber(REGEX_Replace([Point], "(\d+)\D+?(\d+)", "$2"))-[Shift]))
ELSE [Point] ENDIF

ELSEIF [Axis]="x" AND [Shift]<tonumber(REGEX_Replace([Row-1:New], "(\d+)\D+?(\d+)", "$1"))
THEN tostring(tonumber(REGEX_Replace([Row-1:New], "(\d+)\D+?(\d+)", "$1"))-2*(tonumber(REGEX_Replace([Row-1:New], "(\d+)\D+?(\d+)", "$1"))-[Shift]))+","+REGEX_Replace([Row-1:New], "(\d+)\D+?(\d+)", "$2")
ELSEIF [Axis]="y" AND [Shift]<tonumber(REGEX_Replace([Row-1:New], "(\d+)\D+?(\d+)", "$2"))
THEN REGEX_Replace([Row-1:New], "(\d+)\D+?(\d+)", "$1")+","+tostring(tonumber(REGEX_Replace([Row-1:New], "(\d+)\D+?(\d+)", "$2"))-2*(tonumber(REGEX_Replace([Row-1:New], "(\d+)\D+?(\d+)", "$2"))-[Shift]))
ELSE [Row-1:New]
ENDIF



Laying everything out from the last transformation with spatial tools made it easier to read the letters (after I remembered to make the "y" values negative so as not to have upside down letters

estherb47_0-1639423812031.pngestherb47_1-1639423848514.png

 

SeanAdams
17 - Castor
17 - Castor

Very similar situation to @clmc9601  @cgoodman3 - but I used the reporting tools to generate the output instead.

Also - mine had custom picked icons for the macros - it's those extra little touches that count (or so I hear).

 

 

Spoiler
Recipe:
First prep all the data, moving the folds and the dots into 2 different data sets
Then iterate through the folds in an iterative macro - and keep the new paper in a second set of data that you iterate through.
     All you need to do is to adjust the X or Y value of each dot based on the fold, and use a unique to get rid of duplicates


SeanAdams_1-1639599049391.png

 


And here's the macro that does the folding:
SeanAdams_2-1639599092485.png

 



 

 

caitlynmcintyre
9 - Comet

Is it cheating if i rendered the answer using excel because reporting tools are too difficult?

edit: as a self-proclaimed spatial tool fan i'm ashamed i didn't think of create points... i've done too many challenges today

 

Spoiler
caitlynmcintyre_0-1640068236990.png

 

Labels
Top Solution Authors