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 11 (BaseA Style)

jdunkerley79
16 - Nebula
16 - Nebula

 

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

 

77b717aa515d452ea374dd108a230a0c.jpg

9 REPLIES 9
bflick
7 - Meteor

Iterative macros are back with a vengeance.

Spoiler
Definitely an interesting one. I went with a double iterative macro. The first looping through each step and the second looping through the flashes. I gave each cord the status of "", "Flash", or "burnt." Burnts had already flashed so they were taken out of the inner loop. If a point flashed it modified the 8 squares around it using 8 formula tools to update the X,Y and modify.

Workflow
bflick_0-1639204228849.png


Outer Macro

bflick_1-1639204238887.png


Inner Macro

bflick_2-1639204246591.png

 

clmc9601
12 - Quasar

Agreed, @bflick, back with a vengeance indeed

 

Spoiler
I also used a double iterative macro. The inner portion adds energy for the multiple flashes within each step, and the outer macro ensures there are enough steps taken. I put all my neighboring coordinates in a single formula tool and separated them into rows with a delimiter rather than doing each in a separate stream.
Outer macroOuter macroWorkflowWorkflowInner macroInner macro

 

patrick_digan
16 - Nebula
16 - Nebula

It was super slow (5 minutes for step 2) but I was happy with my macro.

Spoiler
I was inspired by @Aguisande to use my multi-field-row macro and it worked great (albeit slowly).
Workflow:
patrick_digan_0-1639226178393.png


Iterative Macro. The magic is the first multi-field-row tool which checks all 8 surrounding cells to see how much energy the cell needs to increase by. It's not very performant with 5+ minute run time, but I could probably clean up a few things to get a little speed back

patrick_digan_1-1639226263908.png

 

 

AkimasaKajitani
15 - Aurora

It is difficult to understand the flashing mechanism, so it took the long time.

In any case, today is iterative macro day.

 

Spoiler
AkimasaKajitani_0-1639229690880.png

Macro for star1
AkimasaKajitani_1-1639229711919.png

Macro for Star 2
AkimasaKajitani_2-1639229734775.png


Spread Energy Macro :

 After increment, this macro repeats until finishing the spreading energy.

AkimasaKajitani_3-1639229752725.png

 

 

 

Git Hub

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

dsmdavid
11 - Bolide

I'm learning a lot of marine biology. And continuously surprised with the number of diverse sensors available in the submarine.

Spoiler
Didn't feel like modifying the macro for part 2, so just ran it for longer. Luckily it worked.
Main workflow calls an iterative macro to go through n number of steps.
Inside there's another iterative that resolves the flashes.

dsmdavid_0-1639238069471.pngdsmdavid_1-1639238693051.png
dsmdavid_2-1639238720873.png

 

 

https://github.com/dsmdavid/AdventCode2021

LiuZhang
8 - Asteroid
Spoiler
Level 1Level 1Level 2Level 2Level 3Level 3workflowworkflow

This exercise is constantly pushing my limit on the macro. Great when it works.

Level 1: standard macro, for each cell, find the adjacent cells, then do 1 iteration of cascade on the energy if current cell is 10 energy.

Level 2: iterate macro, for each step, iterate level 1 until stable state (i.e. no more cell has 10 energy)

Level 3: iterate macro, repeat run for 100 iterations, at each step count number of flashes.

 

For part 2, just increase the iteration limit, turns out it's much less than I expected. Done within 500 iterations.

SeanAdams
17 - Castor
17 - Castor

I used two macros that are not as well known in Alteryx - the disco-ball macro and the Flash macro.    Instead of "Preparation" or "Spatial" - look under the "strange marine" section in the tools.    Used a batch macro with an iterative inside

DiscoBall.jpgTheFlash3.png

 

 

Spoiler

Here's the logic:
- First clean up the input data into rows and columns with each one knowing its neighbours
- then pass this into a batch macro that adds one to each cell; doing the flash; and resetting cells

SeanAdams_0-1639443464571.png

 


SeanAdams_1-1639443488547.png

... there's the disco ball macro.


The Disco-ball & Flash Macro
This is relatively simple:
- create a queue of cells that need to execute a flash
- For each cell that creates a flash - apply this to the board and see what else goes above 10 - and add these to the queue
- Repeat until all the flashes have been done.

the only complexity here is being able to pass the updated board; and ALSO the updated queue through each iteration of the macro

SeanAdams_2-1639443655924.png

 







 

 

Pang_Hee_Choy
10 - Fireball
Spoiler
using the pattern in previous day.

like 
xyMoveadjacentValue
2,2up2,19
2,2down2,38

only link to the 1 layer macro 

in 1st layer macro
add 1 and link to 2nd layer macro for flash
only then filter out o and count for day and flash.

in 2nd macro,
check the value if is 10. and count the value will add to adjacent.
sum it and add to value
repeat until nothing to add.

workflow:

Pang_Hee_Choy_0-1639553730523.png

1st layer macro

Pang_Hee_Choy_1-1639553760490.png

2nd layer macro

Pang_Hee_Choy_2-1639553780601.png

 



 

caitlynmcintyre
8 - Asteroid

Iterations within Iterations, could have used way less tools but I'm so far behind I'm doing for completion rather than finesse

Spoiler
Spoiler
caitlynmcintyre_0-1640057134982.png

 

Macro for Part 1:

caitlynmcintyre_1-1640057154514.png

Macro for Part 2: 

caitlynmcintyre_2-1640057181184.png

and Part B of both: 

caitlynmcintyre_3-1640057222846.png