ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests Early 2026. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

General Discussions

Discuss any topics that are not product-specific here.

Advent of Code 2025 Day 7 (BaseA Style)

AlteryxCommunityTeam
Alteryx Community Team
Alteryx Community Team

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

22 REPLIES 22
AkimasaKajitani
17 - Castor
17 - Castor

Today, it was basically a MAP problem that just flowed from above, so it was easy to think about.

 

 

Spoiler

 

P1 seemed like a bit of a detour, but in the end I was kind of making a macro for P2. I created the macro which calculate each route for P1(actually P2), and then I realized I had to calculate the number of hits later. But fortunatelly I had to do was attach a Macro Output tool to the collision detection and it was complete to create the macro.

P2 is a modified version of P1, where I just added a count column and changed the Unique tool to a Summarize tool. While adding the count column for P2, I realised it was a typical AoC pattern count problem.

Maybe I was lucky.



AkimasaKajitani_0-1765086779822.png

Part 1 macro

AkimasaKajitani_1-1765086956216.png

Part 2 macro

AkimasaKajitani_2-1765087525367.png

 

 

Hub119
12 - Quasar
12 - Quasar

Finally a little ramp up in the difficulty... luckily I recently wrote a blog post detailing handling splitting versions of reality (playing a game with a quantum die) so I had a good idea of how to handle things in part 2 after I got my data parsed and ready to run through the splitters.

Spoiler
WorkflowWorkflow
Spoiler
P1 MacroP1 Macro
Spoiler
The only change here from the part 1 macro (other than taking in our new reality count field, is summing said realities in the summarize tool highlighted in the red box:
P2 MacroP2 Macro
gawa
16 - Nebula
16 - Nebula

It's messy. Unlike other folks, I cannot connect Part1 and Part2 wisely so needed re-building macro for Part2.

Spoiler
image.png
It's a typical graph problem. Key is to summarize number of patterns at each node in the course of tracking from starting node.  Otherwise, your computer will be stopped.
CoG
14 - Magnetar

I started building a simple workflow, then thought, "This is AoC, I should protect myself by being smart"... and wow was that a dumb idea. My optimizations massively increased the size and complexity of my workflow requiring a lot of error handling and re-work. For reference here is the macro I used for my first attempt:

 

Spoiler
First Attempt Macro.png

After submitting my answers, I re-factored, following the simpler approach I had started with originally:

 

Spoiler
Main:
Screenshot.png
Simplified Macro:
Screenshot Macro.png

The better approach involves moving one row at a time -> Figure out where all the tachyon beams are currently, then project into the next row (splitting as necessary). The trick to part 2 involves a computer programming technique called Memoization, Where we store the number of beams that are currently passing through a given point. If two neighboring splitters (they don't have to be on the same row) cause beams to merge, the new count is just the sum of the counts from each parent beam. By tracking this in its own column, part 2 becomes quite easy to solve as the sum of the counts for all beams in the last row of our manifold. 

As a side note, I am fairly confident that this can be solved without a macro too, but doing so would be absolutely awful, and I have no interest presently.

Happy Solving, y'all!

 

ScottLewis
11 - Bolide

That was a bit of a difficulty step up, though for me most of the problems were getting the data types right.

Created a bug inside my part 2 Macro that was setting things to Int32 where this year has proven that everything should just be Int64 whether it wants to or now.

 

Had some fun with part 1 drawing the tree because I built that while I figured out what the sample data was trying to say. That one extra splitter in the sample data that didn't actually get to split, and this count, cost me more time than actually solving part 1.

 

Part 2 was a neat sort of map problem involving inheritance. If you're stuck on this one, think about the problem as finding how many ways you can reach each position in the current row based on the prior row. Then do it for the next row and so on.

 

 

Tokimatsu
12 - Quasar

Solved.

Spoiler
Part 1 and Part 2 used nearly identical logic, yet it took me time to grasp the logic for counting the number of paths in Part 2. I believe this was already formalized, but I ended up needlessly reinventing the wheel.

スクリーンショット 2025-12-07 163034.png

スクリーンショット 2025-12-07 163045.png

I created this diagram and developed the logic.

スクリーンショット 2025-12-08 180721.png

 

Goddenra
8 - Asteroid

Rare occasion where my Part 1 macro assisted with Part 2, although got a bit stuck on the modification I needed.

Spoiler
Goddenra_0-1765101377596.png
Goddenra_1-1765101390421.png

 



 

Macro could definitely do with some tidying up bit it's Sunday and the dog won't walk herself 😉

DaisukeTsuchiya
14 - Magnetar
14 - Magnetar

I was able to solve today's problem with a straightforward approach.

Spoiler

 For P2, I initially thought about keeping a history for each path, but the number of records exploded. By changing my method to sum the counts at each coordinate, I was able to get the processing time down to 5 seconds.

 
スクリーンショット 2025-12-07 204512.jpgスクリーンショット 2025-12-07 204534.jpg
Pilsner
13 - Pulsar

Initially, over complicated this one as I was trying to account for the beam hitting the edge. Turns out this wasn't needed, so I removed that logic from my answer.

Spoiler

Another day where my parts one and two overlap! Here's my workflow:

 

Pilsner_1-1765109495818.png

Macro:

Pilsner_12-1765110140246.png

 




Part 1 & 2
1) I began by splitting the data into a grid and labelling it with coordinates.

Pilsner_7-1765109710273.png

 

 



2) Next, I isolated the starting point and labelled it with a count. This is my count of timelines (and obviously just = 1, at the start point)

Pilsner_8-1765109727496.png

 


 3) Now for the iterative piece. My macro has two inputs. One being the current position(s) of the beam, and the other being the entire grid / manifold. Over each iteration the grid will stay the same but the current position(s) will be updated via the iterative loop. At the start of each iteration, I updated the Row ID to the row below, then joined to the full grid, to figure out if I had landed on a splitter or not

Pilsner_11-1765109956207.png

 


4) By filtering to the splitters, these records can be both output and updated accordingly, so the beam is tracked in the column to the left and right of the current position.

Pilsner_5-1765109654504.png

 


5) The final step in the macro is to combine all the different beam paths back together. After the splitter, some beams may now be combined. Instead of tracking them both going forward, I decided just to track the one, and simply update the “count”. This meant I always knew how many timelines one beam position could be a part of.  

Pilsner_6-1765109672452.png

 



6) Here's the output from the macro.

Pilsner_9-1765109769148.png

 



7) The final step was now nice and simple. To answer part one, I simply needed to count the number of records coming out of the macro. And for part two, I could sum the timeline counts to figure out the total number of timelines (not forgetting to add one, as the initial record wasn’t accounted for).

Pilsner_10-1765109823250.png

 

Labels
Top Solution Authors