Advent of Code 2021 Day 8 (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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Eventually got there with part 2. Like others have said it was a case of working out what fitted inside other numbers. So doing 1 compared to 7 gets you the top part of the number, then if you compare the strings with length = 5 you know that only a 3 contains a 1 (thanks @NicoleJohnson for that tip). If you subtract a 9 from an 8 you get the bottom left position which helps identify the 5 etc...
I also used transpose and 2x summarise tools to convert the strings into alphabetical order, which probably wasn't required, but it made it easier to check combinations, so I stuck with it.
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
I went with the approach that it would be easier to identify segments than numbers. Segment b is in 6 numbers, segment e in 4... segment c in combination with b in 4... etc. If I were to start again, I would not pick this approach...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Yikes! Translating the way my brain solved this problem was ugly, so I'm not posting my solution. I'm not even sure I can post my thought process, but will try when I have some time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Like everyone else said, it just took me too long to understand the problem, then to formulate the solution. As others said, glad this is zoomed out. I'm sure there could be a 25% reduction in tools.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
This one was a mind-bender for me... told myself I can just be content with part 1 and move on with my life but I couldn't stop thinking about haha. The breakthrough moment for me to be able to solve for part 2 was once I realized I could determine the digit using if then formulas to test the length and overlap with the digits discovered in part 1. Turned out to be a pretty successful round of golf 😁
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
It's an ugly one today. No tool golf winner for me
Segment that shows up 9 times is F
Segment that shows up 4 times is E
Segment that shows up 6 times is B
Segment that isn't F in the 1 is C
Segment that isn't BCF in the 4 is D
Segment that isn't EFBCD and shows up 8 times is A
Segment that isn't EFBCD and shows up 7 times is G
Then join back to the input to calculate the true values
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @starkey
Welcome to the club! Can you put your images in spoiler tags so as not to give clues?
Thanks
Dan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
WOW - not only is this quite a formula, but my brain is cooking just trying to figure out how you did this @grossal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
this is clever @danilang - I never thought to count the frequency of the segments.
I went about this using intersection / commonality.
For example - if you're a 6 segment and you do NOT have all the same segments as a 1, then I know that you are the number 6. This does cheat a little though 'cause the instructions specifically say that you should map wires to segments (like you did)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
So - this one took a few hours - and a few wrong turns.
Eventually got a solution by ignoring the segment -> wire mapping, and just looking at the numbers.
I think this is similar to what @NicoleJohnson and @cgoodman3 did?
Translation Logic:
- we can identify the translation for digits 1,4,7,8 just by length
6 segment numbers:
- 6 is the only one without full overlap with number 1
- 9 is then the 6 digit number that shares full overlap with number 4
- 0 is then the remaining 6 digit number
- now we have numbers 0,1,4,6,7,8,9 - only 2,3,5 to go
5 digit numbers:
- 3 is the only 5 digit number with full overlap vs. number 1
- The digit 2 has 2 differences vs. the number 4; where the digit 5 only has 1 difference
To do this Intersection / overlap of the numbers by segment - built a simple macro. You feed in your comparison number (e.g. the number 1) and then the ones you want to compare to - and it tells you how many are missing / matching
The main workflow then looks like this:
- First Prep and clean the data (including sorting)
Then match the numbers based on overlap / intersection with other numbers:
The whole thing is a bit big if you look at it in entirety.
