Advent of Code 2021 - Day 6
Photo by Any Lane from Pexels
I’m participating in the Advent of Code 2021. Here’s my solutions for Day 6 - Lantern Fish.
Problem 1 Puzzles for Day 6 focuses on fish population growth. In this case, fish are on a 7 day cycle. After that cycle, a fish produces a new fish and restarts its own cycle. The new fish has two additional days for its first cycle. So, given this, each fish is represented by a counter: 6 or 8 counting down to 0 each day. After 0, existing fish create a new fish (starting at 8), and reset their own counter to 6. Also, the fish start with a certain number of fish at various points in their own cycles as dictated by the input file.