Discussion thread for day 9 of the Advent of Code : https://adventofcode.com/2020/day/9
Day 9!
Today I made Iterative macro, too.
I'd like to learn Non-Iterative version by anyone's workflow.
Part1 Iterative Macro:
Part2 Iterative Macro:
But It takes less than a minute, so I think no problem.
As anonymous user #1105310
Fun problem... Again no macros - but I did cheat and use Alteryx to generate a super long expression for a multi-field formula for part 1. Without adding the recordID I needed for Part2, part1 has a (cheater) golf score of 3. Part2 looks like almost exactly the same solution as @jdunkerley79
https://github.com/NedHarding/Advent2020
Bit of data explosion never hurt anyone 🙂
Really interesting to see these non-macro alternatives and that they seem to be faster computationally too - enjoying these and learning a ton!
Non-macro part 1 and iterative part 2. Runs in 4.4 seconds non-Amped and errors in Amp and 3.4 in Amp.
The first time I tried it in Amp, the logic in my macro failed because it implicitly assumed that the records in the iterative input wouldn't change order between iterations. It's technically not between iterations, but in the tools that prepare the records to be sent out the iterative output. The solution was to add a Sort tool before the multi-row.
+1 Amp knowledge
Dan
A no macro solution with generate rows creating the data.
Went for 2 x iterative macros! Not clean at all, but just happy I got to the answer 😂
Part A iterative macro (messy!):
Part B iterative macro:
Definitely not winning on tool golf, but my speed is on point. Or on fleek as my 18 year old niece tells me I should be saying.
1.7 seconds.
Still going with no macros
Top flow generates all possibilities of number sums that could be used. Middle flow generates just the ones that will be used. These are joined together. Any set of numbers that doesn't find a match is output.
Second part took a bit more thought. Didn't want to generate all combos of numbers, so tried out different looks at the running total. Turns out that subtracting the number from the running total gets you the segment of comparison.
Loads of generate rows tools got the job done. Would be lovely to feed a measure into the sample tool, which was more performant for me than filters,, to make this totally dynamic.