Discussion thread for day 8 of the Advent of Code - https://adventofcode.com/2025/day/8
I don't think my WF is not so optimized that I admit there is a room for improvement, but I'm satisfied with Macro-less solution at the end.
For Part2, all of connection ID are memorized as string by using the Multi-row formula tool, and check first record that contains all of junction boxes.Even using my powerful computer, it takes 2 minutes. I wanna see other solution for learning wise algorithm.While total 499,500 connections are there, target result is hit at very early examination, that is 4,765th. My WF should have some waste calculation, though I don't figure out how to get rid of them yet.
I did my very best to try and make this problem WAY more complicated than it needed to be for both Parts 1 and 2...
Day 8 was a problem I really enjoyed.
Wow! Seeing non-macro solutions is incredible! I built a macro today to solve via Binary Search algorithm!
Happy Solving!
solved p1
It's been resolved, but I expect a smarter solution for the Day 8.
In part 2, I thought that by evaluating at the midpoint and discarding the branch with no solution, we could explore half the cases at a time and likely find the answer in far fewer than 50 loops. I also confirmed that processing all combinations in the grouping tool took only seconds.
After that, it took time to implement the desired logic and correctly set the completion condition for the iterration macro.
I briefly considered whether manually narrowing down the likely solution range and then checking that range might be faster. However, since it seemed possible to manage without building a highly data-dependent workflow, I decided against that approach.
Solved without macro
Well, it's solved. Not pretty. Impressed by the non-macro solutions!
Back on track today
Basically ran the same logic through an iterative macro.I dropped the coordinates early in part 1, so rather than change part 1 I just join them back on to my phase 2 macro outputs.I could probably have made the iterative macro run less iterations, but this works.
I saved over my part 1 🎻
I couldn't do it in real time today so I took my time.
My solution is macro solution. The difference between Part 1 and 2 is only ending condition.
And for the first time, I used the concatenate distinct option in the Summarize tool.
Part 2 macro:
Day 8
I create another solution inspired by @DaisukeTsuchiya . I created the workflow which will stop when the answer comes using Iterative macro.
Went back and rebuilt my Part 2 solution implementing my version of the approach that @CoG took... SOOO much faster.
First one in a while where I have something exciting to talk about. No special insight on Part1 but if you're stuck on Part2 the spoiler below will drastically simplify the problem.
Part 1, Dual Macro solution, not that different from the others. Possible I need to lean about make group. I like to solve problems like this with nested iterative Macros where the inner one assembles a group and the outer one handles removing that group from the data. That way I get to use iteration.count to enumerate the sets in the out macro and the inner macro doesn't have to keep track of anything except "find every node connected to this one." Single Macro solution is faster, but I find the nested Macros easy to build, especially when I'm tired and this problem didn't seem complex enough to have a need for speed.
Part 2 is the exciting part.
Revisited this puzzle after discussing with @Hub119 and @CoG on WhatsApp.
Implemented improvements:
- Applied more rigorous logic to judge if forming single circuit, that doesn't rely on nature of luckiness in given data
- Cater for dynamic input(sample or my own) by using nested Macro(Iteration Macro inside Batch Macro) to rewrite the parameter for conditional expression via Control Parameter.
- Stop iteration once the result is found
Day 8 is finally complete! Definitely leaned on the community for some much needed help, but I am really happy that I did, as I ended up learning so many new tricks (Explanation and shoutouts can be seen in my reflection)! We live to see another day, and I am excited to take on the 9th challenge.
My Solutions:
The macro used in Part 2
My Reflection:
waste too much time on misunderstand...the method of calculate distance and i thought it skip the count of connection if there already in circuit.
start of bitmask is create in formula
padleft("0",[Max_recordID],"0")
the multi-row formula, wish it have function that replace specific character where it will simplify the formula.
if isnull([row-1:bitmask]) then Left( Left([BitMask],[RecordID]-1)+"1"+Substring([BitMask],[recordid],1000), [Source_recordID]-1) +"1"+substring( Left([BitMask],[RecordID]-1)+"1"+Substring([BitMask],[recordid],1000), [source_recordID],1000) else Left( Left([row-1:BitMask],[RecordID]-1)+"1"+Substring([row-1:BitMask],[recordid],1000), [Source_recordID]-1) +"1"+substring( Left([row-1:BitMask],[RecordID]-1)+"1"+Substring([row-1:BitMask],[recordid],1000), [source_recordID],1000) endif
This one took a good while to get P2 over the line! Had to peek at a couple of spoilers to discover a key stopping condition I was completely overlooking but once I added that, lights out! Shoutout to the 'superstar' tool for this one!
Couldn't get my pt 2 macro to work, so I went macroless.
I was lucky with @Hub119 approach and will go with it.
I had a hard time figuring out what the question was asking for.
First time using this particular tool in an actual build! I had seen it before, but decided today was the day to try it for myself; always good to learn a new trick.
My Day 8 solution. Just realized I forgot to post it.
This one was tricky.
This one took me a while to wrap my head around part 2, and while I got a working answer, I'm not so sure I understand why it works.
I'm happy with my solution for this one. No macros, and I have two 'gotchas', one for each part. Part 1 I saw a chance for a tool I never used before, and for part 2 just an easy way to get where the problem need me to get.
Here's my solution