Free Trial

General Discussions

Discuss any topics that are not product-specific here.

Advent of Code 2021 Day 8 (BaseA Style)

jdunkerley79
ACE Emeritus
ACE Emeritus

1436371257-joseph-michael-luminosity-5-1024x640.jpg

Discussion thread for day 8 of the Advent of Code - https://adventofcode.com/2021/day/8

21 REPLIES 21
clmc9601
13 - Pulsar
13 - Pulsar

What an interesting challenge!

 

Spoiler
I did lots of regex tokenizing on this one. Dividing the segments up into words, then alphabetizing the letters in the words, then adding them back up. I used regex match and process of elimination to determine when it had to be each digit. I checked my work (after submitting a wrong answer) by making sure I only had one unique combination per assigned digit. After fixing my digit-assigning logic, that held true.

I probably used more tools than necessary, as has been the case with the last few challenges. I'm excited to see what other solutions!
Screen Shot 2021-12-07 at 10.56.10 PM.png
bflick
8 - Asteroid

Took a little while to wrap my head around this one. Lots of bug finding later.

Spoiler
Challenge 1 was easy enough just searching for the lengths.

Challenge 2 had me spinning my wheels. Trying to build the parsing dynamically was a challenge and having the output numbers in different orders than the signal patterns just added another headache. A couple missed data fields in transpose tools and forgetting to identify 4 in the output values only added to the difficulty😓

Pretty happy with my end solution though 🙂 

1. Identify the known numbers signal patterns
2. Tokenize the known signal patterns into rows
3. Tokenize the unknown signal patterns into rows
4. Join on the tokenized letters
5. Summarize to get a lines per known number.
6. Use length of signal pattern + known segments to identify the remaining numbers
7. Retokenize all identified numbers
8. Tokenize the output values
9. Join together and identify each number based on matching segment numbers.


bflick_0-1638945280710.png

 

afv2688
16 - Nebula
16 - Nebula

Took me a while just to get to understand what was asked in part 2 😅

 

Spoiler
Untitled.png
AkimasaKajitani
17 - Castor
17 - Castor

This is tough challenge...

 

Spoiler
AkimasaKajitani_0-1638979057870.png
I had to find a detailed pattern anyway.

2 and 3 and 5 have 5 length.
0 and 6 and 9 have 6 length.
After that, I use match rate to identify the number.
I identify each number in each length group using unique length number.
Specifically, I identify 3 in 5 length group(2,3,5) by 1 and 6 in 6 length group(0,6,9) by 1.
After that, I identify 2 and 5 by 6 and identify 0 and 9 by 4

 

GitHub

https://github.com/AkimasaKajitani/AdventOfCode/tree/main/2021

Aguisande
15 - Aurora
15 - Aurora

Only Part 1 (for now...) I hope I have time to solve Part2 (Is it as hard as I think?)

Spoiler
Aguisande_0-1638980543803.png

 

NicoleJohnson
ACE Emeritus
ACE Emeritus

Ooof, this one was rough. Took a while to wrap my brain around how to approach, but once I figured it out, it was just a matter of going through a lot of Parse + Join + Filter iterations... possibly the most RegEx parse tools I've ever used in a workflow 🙂 This one is ugly... but it did the trick.

Spoiler
Part 1 was straightforward. Would have been even easier/faster if I'd actually read the objective instead of starting to try to solve it before actually reading the ask for Part 1.

The key in Part 2 for me was figuring out which numbers "belong to" or "fit into" other numbers, and then backing into the remaining values. For starters, I ignored 8 (since everything fits into 8), hence the "No8" column, and then made a reference key for myself to help remember what "fits into" what. For example, the segments used in the number 1 are also present in numbers 0, 3, 4, 7, and 9. Since I already had 4 and 7, that left 0, 3, and 9. 0 & 9 have 6 characters, but 3 only had 5... so I could filter for Signals with 5 characters, and then find one that "contained" all the letters used in the value I'd already identified for 1. That Signal would then be 3, and I could add that to the list of "known" numbers. I continued in this way, finding values that "fit into" other values (or in some cases, identified cases where they didn't to triangulate the value I needed). 

NicoleJohnson_1-1638981550075.png

 

Here's the final messy beast. Not my finest work, but glad that after a (restless) night's sleep, my brain figured out how to finish this one. 

NicoleJohnson_0-1638981452632.png

 

Cheers!

NJ

grossal
15 - Aurora
15 - Aurora

I have created the worst formula nightmare ... but ... I might have won tool golf ... (only took hours to figure out every detail). Decision was on purpose to not build a macro and/or build something smart. I quickly came to the point where I knew "this could be a one formula thing" and I decided I'll never leave that path.

 

Spoiler
grossal_0-1638982411712.png


You really don't want to click on Spoiler two ....

Spoiler
grossal_1-1638982439118.png

All other numbers are found in a similar way. Used some help columns for 5/6 and than it was just figuring out what is left.

leozhang2work
10 - Fireball
Spoiler
8 - 1.png8 - 2.png8 - 3.png8 - 4.png

The idea is to reorder each entry, then use the number with unique letter count to match match others, eg when 1 (2 letters) concatenate with 2, 3, 5 (5 letters), after remove duplicate letters, only results left represents 3. After a bit iteration on the macro we can deduce all the numbers for each line. 

Though the workflow is definitely not something efficient, will look out for better ideas from others.

patrick_digan
17 - Castor
17 - Castor
Spoiler
My workflow is too ugly to post, but I just used to logic to deduce the 7 segments 1 by 1 by using the number of times a character appers. For example, if I look at all numbers with 2 and 3 segments (1 and 7), 2 characters will appear twice and 1 character will appear only once. The character appearing only once will be the actual segment "a". I did a couple logic comparisons like this to get all of the segments.
Labels
Top Solution Authors