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
aiahwieder
9 - Comet

TheNightmareBeforeChristmasJackSkellingtonGIF.gif

 

I usually LOATHE the grid-based challenges, but this one tickled my inner word nerd! Decided against a macro for Part 1, and was glad to have taken the slower approach when I got to Part 2.

Ccraig6
6 - Meteoroid

Most fun and head scratching one yet!

Spoiler
Day 4.jpg
Medha31
8 - Asteroid

Never expected a use case like this in Alteryx. Tricky one to solve the word search diagonally. Had to take a hint for that bit. 

 

Spoiler
Screenshot 2024-12-04 173339.png

 

 

peter_gb
10 - Fireball

Actually really enjoyed this one, I wasted a whole hour trouble shooting unnecessarily, I think my second answer to part 2 was mistyped into the website the first time I got it... As after a thorough troubleshoot I still couldn't find anything wrong with my solution, tried the same value I was getting consistently and voila.... 

Always fun to see what your actual input/solutions look like with these ones! (after the stars have been secured of course...)

AoC_4_2.png

Spoiler
AoC_4.png

 Went with generating the row/col of each target letter, for each direction, for each possible starting letter to find the XMASs, then for each A as midpoint, what are the 4 corners, are they M or S, and then finally, are my matches conforming to the MAS diagonals logic.

 Change the extension of my xml file to .twb to take a gander at the tableau output. Not insightful, but cool to see. 

geoff_zath
Alteryx
Alteryx
Spoiler
AoC_2024_day4.png

Shelbey
Alteryx
Alteryx

Well this one kicked my butt 😥 but I learned a lot! I was good up until the diagonal matches. I remember a puzzle with diagonal patterns from last year's AoC and I never got through it. Thankfully, everyone here is way smarter than me and posted solutions that were easy to follow so I could learn some new tricks with diagonal patterns 😉.

And a huge thank you to @CoG for having a solution that was so easy to follow that I was able to essentially repeat it (and understand why it worked) and live to see another day of AoC!

 

Spoiler
Screenshot 2024-12-04 121405.png
DataNath
17 - Castor
17 - Castor

In a true act of self-hatred, I saw a couple of people mention RegEx in the WhatsApp discussion group and it made me think... surely this could be done in a single Formula expression? A bit of trial and error later and I present to you one of the most disgusting things created by mankind. 1473 & 765 characters respectively.

 

Spoiler
Day 4 - 2 Expression solution.png

Part 1:

REGEX_CountMatches([DownloadData], '(?=XMAS|SAMX)')
+
REGEX_CountMatches([DownloadData], '(?=X.{'+ToString(FindString([DownloadData], '
'))+'}M.{'+ToString(FindString([DownloadData], '
'))+'}A.{'+ToString(FindString([DownloadData], '
'))+'}S)')
+
REGEX_CountMatches([DownloadData], '(?=S.{'+ToString(FindString([DownloadData], '
'))+'}A.{'+ToString(FindString([DownloadData], '
'))+'}M.{'+ToString(FindString([DownloadData], '
'))+'}X)')
+
REGEX_CountMatches([DownloadData], '(?=X.{'+ToString(ToNumber(ToString(FindString([DownloadData], '
')))+1)+'}M.{'+ToString(ToNumber(ToString(FindString([DownloadData], '
')))+1)+'}A.{'+ToString(ToNumber(ToString(FindString([DownloadData], '
')))+1)+'}S)')
+
REGEX_CountMatches([DownloadData], '(?=S.{'+ToString(ToNumber(ToString(FindString([DownloadData], '
')))+1)+'}A.{'+ToString(ToNumber(ToString(FindString([DownloadData], '
')))+1)+'}M.{'+ToString(ToNumber(ToString(FindString([DownloadData], '
')))+1)+'}X)')
+
REGEX_CountMatches([DownloadData], '(?=X.{'+ToString(ToNumber(ToString(FindString([DownloadData], '
')))-1)+'}M.{'+ToString(ToNumber(ToString(FindString([DownloadData], '
')))-1)+'}A.{'+ToString(ToNumber(ToString(FindString([DownloadData], '
')))-1)+'}S)')
+
REGEX_CountMatches([DownloadData], '(?=S.{'+ToString(ToNumber(ToString(FindString([DownloadData], '
')))-1)+'}A.{'+ToString(ToNumber(ToString(FindString([DownloadData], '
')))-1)+'}M.{'+ToString(ToNumber(ToString(FindString([DownloadData], '
')))-1)+'}X)')​

Part 2:

REGEX_CountMatches([DownloadData], '(?=M.M.{'+ToString(ToNumber(ToString(FindString([DownloadData], '
')))-1)+'}A.{'+ToString(ToNumber(ToString(FindString([DownloadData], '
')))-1)+'}S.S)')
+
REGEX_CountMatches([DownloadData], '(?=M.S.{'+ToString(ToNumber(ToString(FindString([DownloadData], '
')))-1)+'}A.{'+ToString(ToNumber(ToString(FindString([DownloadData], '
')))-1)+'}M.S)')
+
REGEX_CountMatches([DownloadData], '(?=S.M.{'+ToString(ToNumber(ToString(FindString([DownloadData], '
')))-1)+'}A.{'+ToString(ToNumber(ToString(FindString([DownloadData], '
')))-1)+'}S.M)')
+
REGEX_CountMatches([DownloadData], '(?=S.S.{'+ToString(ToNumber(ToString(FindString([DownloadData], '
')))-1)+'}A.{'+ToString(ToNumber(ToString(FindString([DownloadData], '
')))-1)+'}M.M)')​
AdamR
6 - Meteoroid

Heavy use of regex again today for my 8/9 tool solution

 

Spoiler
Screenshot 2024-12-04 230110.png
Kenda
16 - Nebula
16 - Nebula
Spoiler
image.png
Qiu
21 - Polaris
21 - Polaris

@DataNath 
You are amazing..👍

Labels
Top Solution Authors