Discussion thread for day 4 of the Advent of Code - https://adventofcode.com/2023/day/4
There has to be a way to do part 2 without a macro... but since I was racing instead of pondering, I built a macro
simple iterative macroworkflow
@clmc9601
Same! Although your solution is much more elegant than mine.
@CoG @clmc9601
Similar to yours!
I went the macro route as well.
My 1st macro on AoC 2023.
Not a fancy workflow at all, but al least it worked😅.
I spent the time to understand and create logic for part2.
Macro
This one was frustrating, because I had the right idea from the beginning but made a lot of mistakes along the way. I'll let this serve as my annual reminder that generating a lot of rows is often not the best approach, especially with Advent of Code!
First Macro Using Generate Rows: This was going to take forever to run. Very brute force approach in hindsight.
My solution.
Part 1 was very easy. But it took so much time for part 2 because I didn't understand the question correctly and wasted my time. But I am satisfied in the execution time(less than 1 sec).
My first macro in AoC. Definitely learned a bit from the challenge today.
My solution with a quick working macro
No luck with a non-macro solution... tried doing a many-to-many join but the idea fell flat. Would love to see a different appraoch.
non-macro version.
I just random test and boom, hit the result.
1+ iif([Row-1:Sum_match]>0,[Row-1:Count2],0)+ iif([Row-2:Sum_match]>1,[Row-2:Count2],0)+ iif([Row-3:Sum_match]>2,[Row-3:Count2],0)+ iif([Row-4:Sum_match]>3,[Row-4:Count2],0)+ iif([Row-5:Sum_match]>4,[Row-5:Count2],0)+ iif([Row-6:Sum_match]>5,[Row-6:Count2],0)+ iif([Row-7:Sum_match]>6,[Row-7:Count2],0)+ iif([Row-8:Sum_match]>7,[Row-8:Count2],0)+ iif([Row-9:Sum_match]>8,[Row-9:Count2],0)+ iif([Row-10:Sum_match]>9,[Row-10:Count2],0)​
Day 4 done and dusted! Took me a little while to debug my part 2 macro but we got there in the end!
Part I only. Hope to work on Part II without a macro (not sure it's possible, but going to try) later.
Part II: Gave up on the non-macro approach, so here it is with the macro.
Perfect use case for a simple iterative macro - I feel good getting this one done quickly after I was a mess on yesterday's puzzle!
I accidentally mislabeled my batch macro, so had the opportunity to use "Find Missing Macros" function, which worked beautifully. I went the route of a batch macro with a nested iterative macro - not sure both were needed, but it gets the job done.
Another fun one! AND it's macro time... I do love a good iterative macro in the morning!!
Day4. I Macro is brute force to solve it 'faster'
Similar non-macro as @PangHC . I'm forever grateful to @danilang who showed me the power of the multi-row formula tool for the AOC challenges many years ago.
Not my best work, but it's done! Iterative macro took 13 minutes to run, but I don't care!!!
Oof - I predict I'll be good at Iterative Macros by the time the challenge is finished. Thanks to @phottovy for posting your solution file. After my attempts failed miserably, yours was super helpful! We'll see how it goes next Iterative Macro challenge, but I feel like I understand them way better than I did 2.5 hours ago
This one took a while to think how to do it with no macro
Ok, so my iterative macro was being extremely naughty, and so I set it on fire and used a macro-free brute force approach.
Don't judge me.
Still irritated as to why my iterative didn't work...
M.
Forgot to post my solution last night after (temporarily) giving up on the Python solution I attempted after solving in Alteryx.
Anyway, I used an iterative macro for part 2, and I don't regret it. Sorry not sorry.
Too many people mentioning iterative macro crashing their sys. I refused to use a macro. Runtime = 0.5 sec