# AdventOfCode2021 - Day 6

This is a thread to discuss Day6
https://adventofcode.com/2021/day/6

REMEMBER!
It is VERY important NOT to write any public spoilers
ALWAYS keep spoiler stuff hidden inside one of these

Summary

This text will be hidden

which you can obtain by clicking on the gear icon

https://snap.berkeley.edu/snap/snap.html#present:Username=cymplecy&ProjectName=ad21_6
Part 1
Duration 50 secs

https://snap.berkeley.edu/snap/snap.html#present:Username=loucheman&ProjectName=advent%20of%20code-2021-day6

part 1: 255ms
part 2: 767ms

1000 days take 2.7sec with a result : 2.4427818022208776e+40 fishs (i can't verify this result by hand...)

After 3 hours of running and only up to day 170 - I am trying to refactor my approach

Yeah, if you add new records at the end of each day: it's exponential.

hint

Keep in mind: all fish of same state are acting the same way (change state, reproduce)

Try to keep the sum of fish in a same state and make operations on these 9 records)

Just asking: Could you please keep this all in one topic? It keeps appearing in my feed, and I don't participate in this, so it's kind of annoying. Thanks.

Just mute each thread once each day - job done

That's what I do with all yours - joke - I usually don't mute yours

Each puzzle is different and one long thread would be hard to use/read for us puzzlers

Remember - it is the season for goodwill to all

I'm not quite at stage of needing a hint

OK Sorry

here's mine

Part 1

time = 64265 milliseconds, or about 1.07 min

version 2

analyze block in the "Frequency Distribution Analysis" library
and the asoc block is in the list utilities library

without warp
80 day time = 1326 milliseconds, or about 1.3 secs.
256 day time = 4247 milliseconds, or about 4.2 secs

with warp
80 days = 254 milliseconds or about 0.2 secs
256 days = 911 milliseconds or about 0.9 secs

I used @cymplecy's hint to make this one much better.

Project
sorry, removed version 1

um, when I run your solution, it takes a lot longer than 1 minuet. Were you timing it with the example data?

Can't remember - I've been changing things around all day - maybe my earlier attempt was better

Finally managed Part 2 after giving up with my own approach and looking thru reddit for hints

Took 93 ms

Your hint was brilliant.
But I will first try the naive, "brute force" approach.

Part1, naive with list 26 s

Part2, with loucheman hint, 25 - 60 ms. Yes 1000 times faster then Part1 for 80 days

Project