Discussion thread for day 7 of the Advent of Code : https://adventofcode.com/2020/day/7
Golly, I do love me an iterative macro!
For Part 1 macro, used an iterative process that found the parent of every inner bag (and then the parent of that parent in the next iteration).
Cheers!
NJ
https://github.com/AlteryxNJ/AdventOfCode_2020
Modified my standard/iterative inception macro set that I used for building trial balances. After finishing I see that I could have used a single standard/iterative macro set to do both a&b, but it's Sunday night and there is a drink and a dip in the hot tub waiting.
Similar to @NicoleJohnson's solutions.
part 1 iterative macro
part 2 iterative macro
Day 7!
I often fall into the trap of repetitive macros...
Part1 Macro :
As anonymous user #1105310
My Solution
And my macros
Day 7 | iterative macros always make my head hurt but got there...
My brain was not working well enough for iterative macros this morning...
Think mine is a little different to others but same general idea
Macro:
Flows on GitHub: https://github.com/jdunkerley/adventofcode
Note to self - Must read the question. I forgot to swap the inner bag to be outer bags in the second part so wasted a lot of time doing that!
Macro for part A - familiar heirarchy macro
Macro for part B:
Similar to others'
also, keeping track of the lineage...for no apparent good reason (yet, who knows what future days have in store for us...).
https://github.com/dsmdavid/AdventCode2020
Similar solution to other people. Brain not working today so had to fight through an off by 1 bug (I counted the outermost bag.)
But at least my input macro worked perfectly and saved me a few seconds... https://community.alteryx.com/t5/General-Discussions/Advent-of-code-2020/m-p/676655/highlight/true#M3266
Find it at https://github.com/NedHarding/Advent2020
A good iterative macro challenge to get the brain moving!
Nothing novel here, took the same building from inside out and then outside in that most did.
Quite happy with this, one iterative macro for both parts. Nothing earth shattering but re-use where you can!
Finally got the time to post...
Here's my approach, tried to solve both parts with the same kit of macros, until realized that I had to switch inner and outer bags for one of the parts.
So I decided to Save as.. one of the macros, modified as needed and incorporate it (easier way).
This is the pre-iteration macro (used for both parts):
And the two iterative ones:
Part 1 took me a few minutes. Part 2 took me hours to work out that had I just connected to data rather than a text input, everything would be golden ">😫
This one hurt my brain a little - used an iterative macro, similar to others.
Part 1:
Part 2:
Slightly modified macro from part 1: