alteryx Community

# General Discussions

Discuss a wide range of topics! Questions about the Alteryx Platform should be directed to the appropriate Product discussion forum.

## Advent of Code 2021 Day 4 (BaseA Style)

16 - Nebula

25 REPLIES 25
14 - Magnetar

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

14 - Magnetar

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

Cheers!

NJ

18 - Pollux

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

Spoiler

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

15 - Aurora

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.

8 - Asteroid

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.

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!

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

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

Spoiler

16 - Nebula

Doing part two helped improving part 1 🙂

Spoiler
16 - Nebula

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

Spoiler
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