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 10 (BaseA Style)

AlteryxCommunityTeam
Alteryx Community Team
Alteryx Community Team

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

18 REPLIES 18
mmontgomery
11 - Bolide
11 - Bolide

Day 10

Spoiler
Only done P1 so far, and it took me a while. I ended up just randomly assigning 0 or 1 button presses to each wiring then simulating 30000 times then taking the min valueDay10_Mcro.jpgDay10.jpg

I'll work on P2 later

P2

Spoiler
The key for this problem was leveraging the optimization tool! I used sample workflow=>predictive tool examples=> prescriptive analytics=>fantasy sports lineup as a guide. The biggest bug was making sure data types were correct! My subid defaulted to a number but needed to be a string. To make life easier (and take longer), I did it as a batch macro for each rowDay10_Full.jpgDay10_P2.jpg

 

AkimasaKajitani
17 - Castor
17 - Castor

Optimize tool!

 

Spoiler
AoC_2025_10_13.png

Part1 macro

AoC_2025_10_4.png



Part 2 macro

AoC_2025_10_11.png

Later, I would like to solve on Pure Base A. 

AkimasaKajitani
17 - Castor
17 - Castor

I think the R tool, Python tool and Run command tool are obviously restricted in Base A.

 

It's true that the Optimization tool is an R-based tool. However, I think the imporant thing is that R, Python and Run Command tool allow free programming. The R-based tool merely provides a specific function for Alteryx Designer (how that tool is implemented is solely a matter of Alteryx).

However, it is free not to use R-based tool. I would like to call it as Pur Base A. That way makes AoC much more difficult to solve, but also much more rewarding🎉

Goddenra
8 - Asteroid

Have rebuilt my Part 2 to use the Optimization tool. Good learning experience for me as not used it before. Very quick and dirty generation of the required format, but I was learning as I went. 

Pilsner
13 - Pulsar

I was expecting it to keep getting tougher, but this was certainly a step up. Took a couple of long nights, but finally got a solution to part two without using the optimise tool! I will post more of a write-up & neater workflow at a later date, but here's my (relatively) raw solution. Total run time for parts one and two is just under 1 minute in the workflow's current state.  A big shout out to @Hub119, I did download your optimise tool solution so that I had a target "button presses per machine", I don't think I would have arrived at my own solution without this. 

Spoiler
The short explanation is that I implemented Gauss-Jordan elimination to create a "Row Reduced Epsilon Form" matrix (aka implement an algorithm to reduce the number of variables). From here, I only had to worry about a maximum of 3 variables, instead of 10+. With the reduced number of variables, I could then apply a brute force method to find the optimal solution.

Workflow:
Pilsner_0-1765497540808.png

 

 

CoG
14 - Magnetar

And Now.... The moment that a couple people may have been waiting for.... a pure base-A solution to Day 10 Parts 1 & 2. This problem was brutal. I don't think I could have solved this without looking at other's code based solutions to learn that many struggled (outside of Alteryx users), and there were no sneaky insights that could solve this problem. There are certainly optimizations that I made use of to solve that several users mentioned on the Reddit AoC Solutions page.

 

 

Spoiler
Part 1 is solvable without a macro with pure brute force, Generate a super set {1, ... , 2^n} and convert to binary to determine which buttons get pressed, which will account for every possible combination. Key insight here is that pressing a single button more than once is entirely unnecessary. Isolate final state with modulus since multiple buttons can affect the same indicator light. Count it up and your done.

Part 2 is the real headache, with hundreds of millions to billions of permutations to run, this will eat up memory and run remarkably slowly even with hyper optimized brute force approaches. The key here was an approach from Linear Algebra called "Gaussian Elimination", which is basically a way to reframe/change perspective on the problem, so that you have less levers to control (and thus less permutations to deal with). In order for this approach to work I needed to build three different macros:
1. Gaussian Elimination Macro (Performs Gaussian Elimination; although my approach appears to be inefficient)
2. Permutation Generator (Leverages the results of Macro 1 to identify degrees of freedom and generate all possibilities for each)
3. Solver (Takes the permutations and runs through the new linear equation to generate possible solutions).

These macros are hard coded to 13 inputs (maximum for this problem), but they leverage some fascinating dynamic approaches like Dynamic Rename to cycle fields through each iteration, or Multi-Field Formula Tool with helper fields to guide which column needs to be edited dynamically.

Because my Gaussian Elimination solution is not entirely accurate, extra invalid "solutions" are generated. I added a verification section at the very end to ensure that only valid solutions were evaluated, then summed up the Fewest Total Buttons presses to get the answer!

Main:
Screenshot.png

Gaussian Elimination Macro:
Gaussian Elimination.png
Generate Permutations:
GeneratePermutations.png
Solver:
Solver v_3.png

This was remarkably difficult but so satisfying to finally solve. From a workflow that took over 4 hours to solve the smaller cases (up to 9 buttons) and would have destroyed my computer in attempting to solve the entire thing, to a workflow that gave me an answer in 1 minutes and 30 seconds, and I finished before Day 12 released to end this year's AoC!

 

Happy Solving, for the final time this AoC (This is my last AoC solution post for 2025)!

 

 

gawa
16 - Nebula
16 - Nebula

Part2 is not yet done but for just getting Community Budge, I wanna upload mine for part1.

I still pursue how to crack it without the Optimization tool for my skill-up, it would be carry over to year 2026 though.

PangHC
13 - Pulsar

Part1 first.
a very good example to use/learn Binary formula (or so call bitmask (?)), where know as fastest operator.

Part2, No license for Optimization tool Orz.
Take forever with P1 methods. (even just 1st records)

 

Spoiler
Part1
benefit to use binary is to store in less data size and process faster. It take 1.7 seconds for Part1.

convert [###.] to 0111. remember to reverse the string because binary is from right to left
PangHC_3-1765530861995.png

 

convert (3), (1,3)  ->  1000 and 1010  where equal to 8 and 10
1. split to row
2. shift left  1 << [x]
3. sum
PangHC_4-1765530877507.png

 

toggle -> by using Xor it will change the 1 to 0 and 0 to 1. it can done with 1 row,1 column and 1 formula tool.
PangHC_1-1765530786871.png

the rest is similar to bfs method. 
Workflow:
 PangHC_0-1765530722058.png

 

macro:
PangHC_2-1765530803035.png

 



 

 

 

gawa
16 - Nebula
16 - Nebula

At the end, I was able to solve part2 without the Optimization tool, but it took 2 hours running. 2 hours might sound too long, however, if you already tried part2 without the Optimization tool, you know "finishing calculation" itself is still worth enough, I believe.

 

Anyway, I did it, and completed AoC2025.

 

 

Spoiler
I borrowed idea from Part1 to prune the unnecessary records.
Convert joltage values and joltage increments by pushing buttons into light value as follows: 
Even number = 0
Odd number = 1

For example, Joltage value '15_18_19_2' is equal to '1_0_1_0'.

If number of buttons is N, there is total 2^N - 1 patterns of combination of buttons, provided that the same button cannot be used twice or more.
First, find all patterns of button pushing combination and list up all light pattern. I used this list as a fixed reference dataset for further process.
At this point, we need to realize important observation. In the course of joltage value changes by pushing buttons, joltage value as light status is always any of the value in the list of all light status patterns derived by doing the above. In other words, in the course of tracing change in joltage values, if the joltage value which light status is not included in the above list is hit, you can ignore that record since its joltage value is theoretically unattainable.
For example, joltage increments by pushing buttons can be converted as follows, provided that initial status is all 0.
(0,1)           => 1_1_0_0  (push count=1)
(2)              => 0_0_1_0 (push count=1)
(3)              => 0_0_0_1 (push count=1)
(0,1), (2)     => 1_1_1_0 (push count=2)
(0,1), (3)     => 1_1_0_1 (push count=2)
(2), (3)        => 0_0_1_1 (push count=2)
(0,1),(2),(3) => 1_1_1_1 (push count=3)

In the above example, light status such as '1_0_0_0' are not in the list so if joltage value as light status becomes '1_0_0_0', drop it immediately during examination.
Thanks to how I pruned the record during Iteration Macro like this, the number of records were not infinitely inflating.
With this pruning logic, keep iteration until joltage value itself is all 0, then you get the path how joltage value is changed.

After this iteration macro, I configure another iteration macro that trace joltage value from 0_0_...0_0 to target value and sum up the count of pushing button as well. Find minimum value, and sum all...that's it.
image.png

 

Labels
Top Solution Authors