Iterative macros are back with a vengeance.
Outer Macro
Inner Macro
Agreed, @bflick, back with a vengeance indeed
It was super slow (5 minutes for step 2) but I was happy with my macro.
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
It is difficult to understand the flashing mechanism, so it took the long time.
In any case, today is iterative macro day.
Spread Energy Macro :
After increment, this macro repeats until finishing the spreading energy.
Git Hub
https://github.com/AkimasaKajitani/AdventOfCode/tree/main/2021
I'm learning a lot of marine biology. And continuously surprised with the number of diverse sensors available in the submarine.
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.
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
... 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
xy | Move | adjacent | Value |
2,2 | up | 2,1 | 9 |
2,2 | down | 2,3 | 8 |
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:
1st layer macro
2nd layer macro