Now that it's live, don't forget to accept your certification badge on Credly today! Learn more here.

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 11)

Jean-Balteryx
15 - Aurora

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

27 REPLIES 27
jdunkerley79
16 - Nebula
16 - Nebula

Not the fastest or cleanest for part 2...

 

Spoiler
Iterative macros all the way...
jdunkerley79_0-1607676346409.png


Part 2 (slow and messy :():

jdunkerley79_1-1607676401576.png

 

 

 

AdamR
Alteryx
Alteryx

I've not solved it yet, but if anyone wants more background reading this is a modified version of Conway's Game of Life which I did play once before in Alteryx 🙂

 

https://www.youtube.com/watch?v=hcrVS5YOrm4&feature=emb_title

Adam Riley
Principal Software Engineer
Tech Lead Core Engines, Alteryx
dsmdavid
11 - Bolide

I'm almost embarrassed by those ugly generate rows. Almost.

Spoiler
Alteryx_Day_11.png

 Same iterative solves both, just update the rows that enter it. 

AdamR
Alteryx
Alteryx

At last a spatial problem!

 

Spoiler
AdamR_0-1607683350230.png


Base workflow

AdamR_1-1607683373771.png


Iterative Macro

AdamR_2-1607683395194.png


Part 2 is going to need a refactor!

 

Adam Riley
Principal Software Engineer
Tech Lead Core Engines, Alteryx
AdamR
Alteryx
Alteryx

And here it is after the refactor 🙂

 

Spoiler
Pretty spatial data
AdamR_1-1607691592870.png


Parent workflow

AdamR_2-1607691634744.png

Iterative Macro

AdamR_3-1607691668912.png

 

 

Adam Riley
Principal Software Engineer
Tech Lead Core Engines, Alteryx
Balders
11 - Bolide

One macro for both parts for me. My hint would be to work out your seat pairings list before iterating through the occupancy changes.

 

Spoiler
Main workflow. Creating the seat pairs was for part 2 was long a took a little debugging. One missed tickbox on a multi-row grouping had me stumbling for a while.

A few notes on the solution:

- I used row and col fields to find seat pairings, but then combined those into a single seatid field before going into the macro.
- I added ring of empty "." spaces around the room to avoid wraparound issues on the edges.
- Once spaces have been given an ID, empty "." are not needed in the iteration checks, they always stay "." and don't affect seating choices so they're filtered out before going into the macros or working out the next seat in part 2. 

d1f132a7-273b-4982-9bc2-0c1fcbad7927.png

Iterative Macro. Half of the tools here are just creating a proper escape for the iterations as opposed to pair matching.Screenshot 2020-12-11 130138.png
patrick_digan
16 - Nebula
16 - Nebula

Mine was a mess today, but I got there in the end.

Spoiler
Part 2. My macro isn't complicated, but the price I pay is time. Part 2 took 5 minutes in its entirety. I spilt it into 2 parts. 1 part in the main workflow figures out where each seat needs to check (brute force), and then the iterative macro does all of the iterations (again, very brute force). 

i used my normal approach with these AOC problems using a single long string. It makes it fairly easy to work with and bebug, but It just isn't performant when you have to replicate the string a bunch. Glad this one's behind me solved. I'm sure the Alteryx Abacus would make it much more performant.
patrick_digan_0-1607694299134.png
patrick_digan_1-1607694320502.png

 

 

NedHarding
7 - Meteor

Mine was way to messy and hacked together for me to post...  Wasn't that hard in theory, in practice it drove me crazy debugging it.

peter_gb
8 - Asteroid

Quite happy with mine, my final solution makes up for the nightmare mis-read of part 1! Didn't resort to reddit or here today 🙂
I had to leave this for a while to go and work after part 1 - wasted an hour by misinterpreting the part one as look 8 seats in each direction, not 8 seats, 1 in each direction.... DOH!

 

Iterative macro for part 1, then an iterative to prepare for part 2 by looking for the next seat in each direction for each seat as this doesn't change.

Then a modification of my part 1 macro to solve part 2. <1 min so not too horrible either.

Full

Spoiler
11.png

    

macro1

Spoiler
11_1.png

macro2 to prep part 2

Spoiler
11_2.png


macro 3 to solve part 2

Spoiler
11_3.png

  Edit - also had fun seeing how the seats filled up:-

Spoiler
11.png


https://public.tableau.com/profile/petergb#!/vizhome/Day11_16077110205010/AoCDay11