Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

General Discussions

Discuss any topics that are not product-specific here.

Advent of Code 2021 Day 4 (BaseA Style)

jdunkerley79
ACE Emeritus
ACE Emeritus

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

25 REPLIES 25
Aguisande
15 - Aurora
15 - Aurora

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)

Spoiler
Aguisande_0-1638635813709.png

 

 

NicoleJohnson
ACE Emeritus
ACE Emeritus

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...)

 

Spoiler
NicoleJohnson_0-1638637942864.png

 

Cheers!

NJ

danilang
19 - Altair
19 - Altair

A rare case where solving for part 2 actually made the solution for part 1 somewhat easier

 

Spoiler
danilang_0-1638651224095.png

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

danilang_1-1638651390793.png

 

 

Dan 

Jean-Balteryx
16 - Nebula
16 - Nebula

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.

 

JeanBalteryx_0-1638651612652.png

 

JeanBalteryx_1-1638651694815.png

 

 

leozhang2work
10 - Fireball

4 - 1.png4 - 3.png4 -2.png

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.

estherb47
15 - Aurora
15 - Aurora

Also went a macro=less route.

 

Spoiler
Thought process. This looks like Find and Replace could work, if I replace the numbers on the board with the round in which they were drawn. A row or column would be completed with the Max number for that round.

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!
estherb47_0-1638682600699.png

 

grossal
15 - Aurora
15 - Aurora

Bit late to the party. I went the macro route first, but decided to also do the non-macro route afterwards.

 

Macro - Part 2 only needed one additional join condition - quite beautiful

Spoiler
grossal_1-1638695228997.png

 




grossal_0-1638695163865.png

 

 

Non-Macro: Very satisfying too. Took only an additional Sort/Sample to make part 1 ready for part 2.

 

Spoiler
grossal_2-1638695558825.png

 

 

 

 

afv2688
16 - Nebula
16 - Nebula

Doing part two helped improving part 1 🙂

 

Spoiler
Sin título.png
afv2688
16 - Nebula
16 - Nebula

Finally got time to look for number day 4 without a macro 🙂

 

Spoiler
Sin título.png
joshbennett
11 - Bolide
11 - Bolide

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 👌.  

 

 

Spoiler
joshbennett_0-1638860907460.png

 

joshbennett_1-1638860990880.png

 

joshbennett_2-1638861009631.png

 

 

Labels
Top Solution Authors