Advent of Code 2021 Day 4 (BaseA Style)
- 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 4 of the Advent of Code - https://adventofcode.com/2021/day/4
- Labels:
- Advent of Code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Day 4. I spent more time on part 2 (I thought it was straightforward on this logic, but turned into a section to adapt what I did for Part1)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Redone with NO MACRO this time!! Success!! WAY cleaner looking this way, and probably good practice in case we find ourselves facing another Intcode scenario this year... *shudders* (@patrick_digan , your string methods for non-macro Find & Replace functionality will be forever an inspiration to me...)
Cheers!
NJ
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
A rare case where solving for part 2 actually made the solution for part 1 somewhat easier
The iterative macro originally had some complex gymnastics to exit as soon it found the first solution. Adding in the requirement that we needed the first and last solution meant that I could simplify to just run until all the called numbers where processed
Dan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Scratched my head on part 1 then part 2 was easier as it used the same logic to start with.
I'm gonna look for a version without macro.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Took a while to get the macro order correct for me, went into some dead ends. (some steps can be cleaned) Run iterative macro for each board for final score, then batch macro for each board. Part 2 is easy for me as it is just a change of sort in the final results.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Also went a macro=less route.
Then, for each card, figure out the Minimum winning row, and then the minimum amongst all of the cards.
Another find-replace, for all numbers that fell before and up until the winning draw with zero. Some parsing, summarizing, and multiplying to get the answer.
I just had to chance the Min to Max logic for part two - find the card with the last completed row.
Lots and lots of tools!
- 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
- 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
I am not a huge fan of my solution for this one and felt like I made it more complicated for myself than it needed to be (which I confirmed after reviewing some of the other solutions), but it got there in the end.
I really enjoyed looking at the macro-less solutions from @bflick / @cgoodman3 / @dsmdavid / @AkimasaKajitani / @patrick_digan / @Aguisande / @NicoleJohnson / @grossal / @estherb47 - Very elegant, simple, and performant 👌.
