Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

General Discussions

Discuss any topics that are not product-specific here.

Advent of Code 2021 Day 6 (BaseA Style)

jdunkerley79
ACE Emeritus
ACE Emeritus

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

 

JessL_0-1638911708532.jpeg

 

22 REPLIES 22
danilang
19 - Altair
19 - Altair

That's a lot of lantern fish, making for a very bright ocean.

 

Non-macro (here you go, @bflick) solution running in 0.3 sec for the 256 days.  I have many happy!!  

 

Didn't win Tool Golf, @NicoleJohnson, but I might just have the fastest solution 

Spoiler
danilang_0-1638798127041.png

Uses a multi-row tool that looks back up to 17 rows with special conditions to calculate the current count of 8 and 6 fish.

Dan

 

 

patrick_digan
17 - Castor
17 - Castor

@danilang Very cool! @bflick It's not baseA (and it wouldn't beat the speed of danilang), but I used the alteryx abacus to solve it without macros

Spoiler
patrick_digan_0-1638799769901.png

 

estherb47
15 - Aurora
15 - Aurora

Went the iterative route, and like many others, realized that generating numbers was way too slow.

 

Spoiler
Generating the count of each number was the way to go. When you reach zero, replace those zeros with an 8 and a 6, copying the count of the number for zero for each.

I'm sure there's a non-macro way to do this, just haven't figured it out yet.

Anyone else frustrated in removing the commas when you generate a number with Alteryx?

DataG8
8 - Asteroid

I finally had to bite on the macro bait. I think @NicoleJohnson is right that there is a mathematical solve with factorials and modulus functions but I didn't get there. Then I tried generating rows, that didn't work past 30 days. My first macro left it in rows and does the 80 days fine but slowed way down about 135 iterations in. After all that, I figured it out the same way most of the others did.

 

Cheers, Michael

Spoiler
SolutionSolutionMacroMacro
dsmdavid
11 - Bolide

Different version of macro-less  

Spoiler
with a `fun` generate rows...dsmdavid_0-1638807146924.png

 

https://github.com/dsmdavid/AdventCode2021

Edited for Golf points:

Spoiler
dsmdavid_0-1638822428569.png
@danilang well, this one doesn't perform that well, but it counts towards golf points 😅

 

 

LiuZhang
9 - Comet
Spoiler
6 - 1.png6 - 2.png6 - 3.png

Really went nowhere with this one, have to look what others did. @NicoleJohnson's '6,8' split give me the idea to do part 1, then part 2 went nowhere again with the speed, another idea on the summarize helped on the part 2. Learnt a lot about AMP engine for the wrong reason 😂 

joshbennett
11 - Bolide
11 - Bolide

Like most others, iterative macro FTW.

 

While it runs in less than 1 minute at ~44s, I am curious if anyone comes up with a faster solution without an iterative macro - definitely seemed the path of least resistance to me.

 

Spoiler
joshbennett_0-1638856503141.png

joshbennett_1-1638856524850.png

 

 

afv2688
16 - Nebula
16 - Nebula

Non iterative 0.2 seconds

 

Spoiler
Untitled.png
SeanAdams
17 - Castor
17 - Castor

Like many of you - I iterated using a macro - but used a Batch Macro instead just to buck the trend.    I find that batch macros pretending to be iterative macros are MUCH easier to debug.    I want to go back and look at some of the formulaic solutions now 🙂

 

Spoiler
first summarized so that you only had 9 buckets, and filled in gaps to make this easier.

SeanAdams_0-1638906305407.png

 

You'll see that I pump the fish data out to a file

Then, using a Fake Macro Input (FMI) - simulated an iterative macro.    Again, the great thing about this is it's super simple to debug (unlike an Iterative Macro) because each time you run it, it's one iteration

SeanAdams_1-1638906439668.png

 

danilang
19 - Altair
19 - Altair

Challenge accepted @joshbennett 

 

.3 seconds non-macro.  See my post above.  @afv2688 is measuring in European time.  That's why his solution is .1 second faster than mine.

 

Dan

Labels