We have extended our Early Bird Tickets for Inspire 2023! Discounted pricing goes until February 24th. Save your spot!

alteryx Community

# General Discussions

Discuss any topics that are not product-specific here.

## Advent of Code 2022 Day 19 (BaseA Style)

Alteryx Community Team
5 REPLIES 5
16 - Nebula

I couldn't create a specific algorithm to make geode efficiently. As a result, I solved this challenge by making all patterns while reducing the records.

Spoiler

Macro for Part1 and 2:

17 - Castor

It took a lot of time to write all the logic, but got there in the end.

Spoiler
Similar to day 16, just created all the possible paths/actions and then only kept the top 50,000 paths. It took a minute to get the sort right.

13 - Pulsar

Seemed like there should have been a math-based solution, but I didn't find it...

Spoiler
Instead, I took the iterative route. The toughest part was keeping record count from exploding. Lots of information to store in variables: I passed 20+ fields between iterations.

The macro logic is complete by the second formula. The rest of the tools are purely for reducing record count.

workflow, only a slight adjustment in detour for part 1 vs 2iterative macro
10 - Fireball

same concept. but i used batch macro + iteration macro instead. easier to build by this way.

Spoiler
Part1:

extract data and crosstab it. this is master data for required resource for each robot.

workflow

In batch macro, create a start. 1 ore robot. and iteration macro to process by each blueprint.

batch macro

in iteration macro,
add 5 possible moves (builds 1 of 4 robots or nothing), add rows control.
sort by total geode, total obsidian, and total clay. (used + current)

iteration macro

Part2:
careful on data you to multiply. just multiply for geode. need not multiply with blueprint number.
increase the record control if the answer is too low.

17 - Castor

:-) this felt like an easier one - including from some debugging, got this one done in a few hours.

Spoiler
I treated this as a depth-first tree search - where at each iteration, you add on child nodes for