Let’s talk Alteryx Copilot. Join the live AMA event to connect with the Alteryx team, ask questions, and hear how others are exploring what Copilot can do. Have Copilot questions? Ask here!
Start Free Trial

General Discussions

Discuss any topics that are not product-specific here.

Advent of Code 2024 Day 4 (BaseA Style)

AlteryxCommunityTeam
Alteryx Community Team
Alteryx Community Team

Discussion thread for day 4 of the Advent of Code - https://adventofcode.com/2024/day/4

61 REPLIES 61
CoG
14 - Magnetar

Whoo! I enjoyed this tremendously. I will include a more thorough explanation for my approach below later (in the form of a YouTube video), but for now here is my solution.

 

Solution Screenshot (Updated to Simplify):

Spoiler
Main V2.png

Tool Golf V3 Solution (10 Tools per Part):

Spoiler
Main V3.png

Tool Golf V4 (Part 1: 6 Tools, Part 2: 7 Tools):

Spoiler
Main V4.png

 

ScottLewis
11 - Bolide

That was a really neat one. Similar to some of the harder ones last year, but with fewer complications. Part 2 seemed easier than Part 1, though that could just be having done Part 1 first. Interesting to see the different ways people deal with this.

Sharing file this time because it's pretty and I like the solution. Those have not both been true on previous days.

 

Spoiler
I approach graph type problems by transforming the data in to row/column/value triplets. You can then map movement in a direction to a simple 1 point change in row/column and get a new value by re-joining with the original data set. In this example, we rejoin with the next 3 (XMAS) or with one in each diagonal (X-MAS). Part 1 requires generate rows to get all the possible directions.
I think I could have left out the filter to throw out out-of-bounds values and let the joins do that but that's the sort of thing that causes errors in harder problems so I like to keep up good habits. Conversely, hard coding the maximum row/column count is a terrible habit that we allow as a concession to speed. In a production world this would be join with count of rows and filter on row<=Maxrow.


 
Day4Scott.PNG

 

PangHC
13 - Pulsar

have to use macro this time. diagonal is hard to do without macro

and luckily I save some macro last few years. like split to x and y. and generate the adjacent location. 

it save some time to re-build it. 

Spoiler
part1: skipped for vertical and horizon. diagonal I use filter to find the beginning cells and use macro to search for next cells (move up or move down to right)

part2: easier than part1, haha. 
filter for data value "A", get adjacent, check the diagonal values
Screenshot 2024-12-04 140036.png

 

kelsey_kincaid
12 - Quasar
12 - Quasar

This one was a fun challenge! There's a lot of sloppy design in this first pass, but I'm excited to clean up the logic later this week.

 

Spoiler
I spent far too much time wondering why my Multi-Row formulas weren't behaving - turns out I forgot to sort first. I also started at position 1 in my string instead of position 0. This was a good reminder that it's often the fundamentals that cause issues, and that building workflows is probably done after a good night's rest, not before :) 

Eager to clean up the macro so that I can use a single macro for both parts. I also want to see if I can use Regex to count matches in the diagonals, but I'll need some sleep before I work that out!
2024_Day4_KelseyKincaid_WF.png
I took the lazy way out and set my max iterations to the size of the data. NOT best practice, but it worked for me to get a faster answer, so I went with it for now.
2024_Day4_KelseyKincaid_Macro.png
This is one of my multi-row formulas. I used each to look at diagonals going different directions. In hindsight, I don't know that I need all 4, so that's another thing I'll look at tomorrow.
Substring([data],[Engine.IterationNumber],1)+
SubString([Row-1:data],[Engine.IterationNumber]+1,1)+
Substring([Row-2:data],[Engine.IterationNumber]+2,1)+
SubString([Row-3:data],[Engine.IterationNumber]+3,1)​

 

NicoleJ
Alteryx
Alteryx

It's challenges like these that make me wish I had an index listing all the things I've built in the previous Advent of Code years to solve the same exact thing...  "Alexa, tell me how I solved this 'find the coordinates' problem the last 20 times it's come up in Advent of Code..."

Spoiler
Day4NJ.png

Today's "new Designer features in action" shout-outs: Dark Mode (because I didn't get enough sleep last night getting stuck on Day 3 Part 2, so my eyes already hurt), and Group By in the Record ID tool! ❤️

Cheers!
NJ
Sr. Manager, Product Management, Designer
Alteryx
rbgruwel
8 - Asteroid

Nice way to solve a crossword

 

Spoiler
Example.png
Hub119
11 - Bolide
11 - Bolide

Okay, time for bed. *NOTE: made some tweaks today and reposted so my solution is more clearly labeled and easier to follow (that seems to go out the window at 1 in the morning...)

Spoiler
AoC D4 Pic.png
AkimasaKajitani
17 - Castor
17 - Castor

My solution! This is messy.

 

Today it took a long time because I was away for 20-30 minutes in the middle of Part 2. I don't like diagonal...

 

Spoiler
image.png
suwenchuan
7 - Meteor
Spoiler
AlteryxGui_ZXufGV0djl.png
Labels
Top Solution Authors