We are updating the requirements for Community registration. As of 7/21/21 all users will be required to register a phone number with their My Alteryx accounts. If you have already registered, you will be prompted on your next login to add your phone number.

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 2020 - BaseA Style (Day 17)

Jean-Balteryx
15 - Aurora

Discussion thread for day 17 of the Advent of Code : https://adventofcode.com/2020/day/17

9 REPLIES 9
jdunkerley79
16 - Nebula
16 - Nebula

Main issue with today was understanding the example... and I refused to do iterative as wanted to debug easier

Spoiler
jdunkerley79_0-1608189433443.png


And the inner macro:

jdunkerley79_1-1608189550269.png

 



 

Greg_Murray
12 - Quasar

@jdunkerley79 the example was pretty horrid. I think it could have been much more clear without giving too much away.

 

Here is my solve. I took the iterative route for both parts and it ended up being surprisingly similar to my day 11 solution. 

 

Spoiler
workflow
Greg_Murray_0-1608213902884.png

part 1 iterative

Greg_Murray_1-1608213951047.png

part 2 iterative

Greg_Murray_2-1608214024766.png

 

 

AkimasaKajitani
14 - Magnetar

Day17!

 

I almost gave up when I couldn't understand the example...It took much time. I agree with @jdunkerley79  on this point.

Today's my solution is Iterative route.

 

Spoiler
AkimasaKajitani_1-1608214759422.png

Part1 Iterative Macro

AkimasaKajitani_2-1608214941632.png
Part 2 Iterative Macro : Add w-axis to Part1 Macro
AkimasaKajitani_3-1608215047597.png

 

 Finally, my challenge worked.

 

AS anonymous user #1105310

https://github.com/AkimasaKajitani/AdventOfCode

 

dsmdavid
11 - Bolide

I concur that the example was difficult to understand (at least for me, it took me a while to realize that there were rows/columns disappearing).

I went with an iterative, it required minor changes to incorporate the "w" from the second part.

Spoiler
Alteryx_Day_17.png

I wondered if it would be any faster to precompute the whole board since I thought so many generate rows couldn't be that good

Spoiler
dsmdavid_0-1608216249411.png

 

patrick_digan
16 - Nebula
16 - Nebula

I went for slow and simple with an iterative macro. I just computed entire board plus an extra space or 2. Lots of copying and pasting.

Spoiler
patrick_digan_0-1608217887963.png
patrick_digan_1-1608217935318.png

 

 

Balders
11 - Bolide

Fun one this, mine runs in 0.8s for the whole flow. Two separate macros for 3d and 4d. 😊

 

Spoiler
Three performance tips for me.
1) filter out "." values you don't need them.
2) Generate only your collisions, this follows from 1)
3) shift your plane to stay within byte data types. 

Workflow
Screenshot 2020-12-18 013000.png

Part 2 macro. This has 1 more generate rows than my part 1 macro for the extra w dimension. This could have its condition toggled and folded back into one macro. 

My macro has a toggle for the number of iterations as I expected us to have to run 100 iterations in part 2 or something, I didn't need the toggle in the end and could have hard coded "6 iterations but I left it in anyway and made for a nice gif in the post below. 

My macro steps.
1) Filter out "." from the initial data. This could in fact be done outside the macro as its not used after step 1. 
2) generate collisions in each dimension, tripling rows at each step, looking at -1,self,+1.
3) tag the centre self collision.
4) keep only cubes with 2 or 3 collisions.
5) join back on against self colliders. 
6) filter to only active cubes for next iteration.
7) repeat.
Screenshot 2020-12-18 012935.png

Balders
11 - Bolide

50 iterations of part 1 as a gif 🙂

 

2020-12-18_02-09-53.gif

Balders
11 - Bolide

Optimised and golfed, 1 macro with a toggle for 3 or 4 dimensions. Workflow runs in 0.7s but it looks much cleaner now.

 

Spoiler
Workflow
AoC v2 Workflow.png

Macro, and no purple tools used 🙂AoC new Macro.png
Jean-Balteryx
15 - Aurora

Definitely not clean but works !

 

Spoiler
Capture d’écran 2020-12-21 à 22.29.56.pngCapture d’écran 2020-12-21 à 22.43.24.pngCapture d’écran 2020-12-21 à 22.46.24.png