This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
Though I'm wary of iterative macros in the world of AoC (#IntcodeNightmares), this one seemed innocent enough. For now. 😉
I've built my fair share of "parent-child" macros over the years (six degrees of Kevin Bacon, anyone?), so this was at least a familiar path. Parsed out the bag descriptions & quantities and then built simple macros for part 1 & 2 to find the inner-outer combos (or outer-inner combos). While the macros were similar, they do lookup data in different directions, so created a separate instance for each part.
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).
For Part 2, swapped the join to find the Inner bags & quantities for each Outer bag, summarized, then called them "outer" for the next iteration, repeating the process.
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.