In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
Start Free Trial

General Discussions

Discuss any topics that are not product-specific here.

Advent of Code 2025 Day 4 (BaseA Style)

AlteryxMatt
Moderator
Moderator

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

Matt Rotundo
Alteryx Community Moderator
24 REPLIES 24
ScottLewis
11 - Bolide

That was a good one. 

Nice to see the return of grids, always appreciate doing part 1 while fretting about what part 2 could be.

This time, it was relatively kind.

Pleasantly surprised to find the multi-row formula tool goes all the way up.

Expected an error message along the lines of "138 is to many what the ^&## are you doing?"

 

Observations and tips

 

 

Spoiler

Whenever we're going to count something (In this case, adjacencies) I like to convert that thing from text representation into 1/0 so that we can do math to it later. In this case, it let me use a single multi-row to do the check by adding all 8 adjacent values together rather than making them 8 tests for "@".

 

Keeping your data orderly, which may involve turning off the AMP engine, often lets you shortcut. In this case, by keeping Row/Column sort we can know the index of any given adjacency.

 

Most of the complexity in this one is dealing with the (literal) edge cases. Wrote conditionals for Column and Row at Max and Min values. The other way to do this is to pad the grid with a row and a column of 0 values. In this case the conditionals were fairly clean so I didn't pad but there is value in taking complexity out of your formulas and putting it on the canvas.

 

It helps to think about the boundaries of a problem. We have in the past, and likely will again this year, seen problems that are either unbounded or at the minimum geometric. Those are the ones that will burn your computer down and require extreme macro optimization. pruning or formula trickery. This is not that. You're removing at least 1 crate every iteration, which means the problem is in N time with respect to the number of locations (actually the number of crates, which you can count or just estimate density and round up.)

 

With upper bound of <20k and with a high density estimate of 10k  your macro should run in reasonable time (Minute and a half for mine, as an example.) If it doesn't, try to figure out why, because you will need the space(time) for future problems.

 

As a bonus, a bounded problem means you don't have to do an end state for the macro, which I find to be the most awkward part of iterative design. You can just run 10k times knowing that the last few thousand will likely be adding 0.

 

 

 

 

Final, with the Macro pasted in.

Working with numbers means I get to skip a few steps relative to some of the other Macro versions.

 

Day4 2025 Scott Lewis.png

 

 

kelsey_kincaid
12 - Quasar
12 - Quasar

I almost severely overcomplicated this one! Reminder to read the prompt before assuming what they are going to ask :) 

Spoiler
Part 1 was pretty straightforward and just required finding adjacent values - something that's pretty standard in AOC puzzles. At first I thought we were only able to remove one roll at a time, which would require pretty extensive iterative optimization. When I reread the prompt I realized it was luckily much simpler than that.
Day4_Workflow.png
Day4_Macro.png
DanFlint
8 - Asteroid

This was a fun one!

Spoiler
DanFlint_3-1764885951750.png

 


Had to build a multi-field-multi-row formula to get my method to work out dynamically:

DanFlint_1-1764885744962.png

 

And as much as I wanted to do something different, for part 2 I just wrapped it all in an iterative macro where I rebuilt the grid without the removed rolls each time:

DanFlint_2-1764885886964.png

 

Samantha_Jayne
Alteryx
Alteryx
Spoiler
I had to use spatial on this one, wasn't sure if I would be able to again.

AOC - Day 4.png
Samantha Clifton
Alteryx
#alteryxrocks
Samantha_Jayne
Alteryx
Alteryx

How are you going to cope when its over in a few days? Finish the whiskey advent calendar? Maybe we should design our own crazy puzzles for next year. 

Samantha Clifton
Alteryx
#alteryxrocks
Labels
Top Solution Authors