First part was a variation on the "Game of life" a...
# advent-of-code
l
First part was a variation on the "Game of life" and Part B I did with a little of math magic inspired by @andyb's thoughts from one of the previous days 🙂
a
How did you get the hardcoded values of 610 & 28?
l
first I plotted a graph to find out whether it starts oscillating or not, and if yes (and it did), I picked the period size by hand + offset from which point it oscillates. That was all 🙂 . My first thought was it will settle at some value, but this time it wasn't the case.
a
Fair enough, I did it programmatically & wondered if there was a mathematical way of calculating these values.
g
Mine is 28 as well, but somewhere before hitting 500. I toke 'snaphots' at the 100th..200th.. iteration and each iteration compared to the snapshots worked fast enough
a
I think 28 is common but it took me longer to reach this state.
g
I just tried my own one, and I only know it was 28 because I had an off-by-one error in that part of the code.
l
I think it should be possible to construct some polynomial which would yield the correct result for any number since oscillation onward, but I am not that crazy to try to do such thing 😁