Discussion thread for day 6 of the Advent of Code - https://adventofcode.com/2021/day/6
Shortest gap between * and ** today, and fastest overall solve (started at 5:15am) (excluding day 1 where I can't remember when I started, but was probably the fastest day overall).
Macro:
It was much simpler than I thought, I was imagining that we were going to head back into monitoring germinating flowers in space (I think 2018?), and that the part two logic wouldn't just be a case of iterating over more days (added interface tool after the solve), but instead that there would be some need to keep track of generations as older fish might end up with longer gestation periods or something like that. So far AoC is being kind...
Tried to do it without an iterative macro, but couldn't figure it out. Looking forward to seeing if anyone does.
I'm sure there is a math way to solve this, and given enough time I am sure I could have googled it... but today is not that day. Iterative macro it is!
And the macro...
Super stoked about how this one ended up. Only 14 tools used, and the 256 day iteration runs in less than 1 second!! I love it when an iterative macro plan comes together...
Cheers!
NJ
Wow, the lanternfish really did take over...
Today is reflection.
But at star2, it takes too long time and finally this macro could not output the result. Because too many data kept me away.
After finishing the result, I made the macro bellow to be able to change the iterative count.
Final Workflow :
GitHub
https://github.com/AkimasaKajitani/AdventOfCode/tree/main/2021
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
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
@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
Went the iterative route, and like many others, realized that generating numbers was way too slow.
Anyone else frustrated in removing the commas when you generate a number with Alteryx?
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
Different version of macro-less
https://github.com/dsmdavid/AdventCode2021Edited for Golf points:
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 😂
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.
Non iterative 0.2 seconds
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 🙂
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.
Like everybody else, realized that the simple, brute force method was not going to work for part 2, so had to rewrite to group the days and handle mathematically. Took entirely too long as I struggled with the addition of the 0's to the 6's. Would really like the ability to create read-write variables. Anyhow, here's my solution.