Advent of Code 2020 - BaseA Style (Day 7)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Discussion thread for day 7 of the Advent of Code : https://adventofcode.com/2020/day/7
- Labels:
- Advent of Code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Golly, I do love me an iterative macro!
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.
Cheers!
NJ
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Day 7!
I often fall into the trap of repetitive macros...
Part1 Macro :
Part1 Macro :
As anonymous user #1105310
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Day 7 | iterative macros always make my head hurt but got there...
 
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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:
Check out my collaboration with fellow ACE Joshua Burkhow at AlterTricks.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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