My attempts to work through the 2021 Advent of Code problems.
Log | Files | Refs | README | LICENSE

```commit 0f7544e030e1df70304dc905e6553af75231da89
parent d09a7ee0d208424bc2deb601ce434dea95888327
Date:   Mon,  6 Dec 2021 11:40:25 -0500

Solution to day 6, part 2

Diffstat:
```
```1 file changed, 35 insertions(+), 0 deletions(-)
diff --git a/day06_part2.py b/day06_part2.py
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+"""Advent of Code 2021, day 6 (part 2): simulate an exponentially growing
+school of lanternfish using an initial list of fish and their ages... for a
+longer period than part 1"""
+
+# I find myself metagaming a little bit: anticipating how part 2 will build
+# upon part 1, while trying to make it easy to accommodate in my existing code
+# without over-engineering things for functionality that won't become
+# necessary. IME, this is what being a programmer (including 'data scientist')
+# in the real world is actually like.
+#
+# In this case, I was imagining something more complicated, like: maybe there
+# are a couple different types of fish, or maybe the fish die eventually, or
+# maybe the spawn rate depends on the size of the school. But instead we're
+# doing something dead simple: running the same solution as before, but for
+# longer. I suspect that this is supposed to punish people who
+# implemented a list of fish instead of a set of counts.
+
+from day06_part1 import (convert_input_to_series,
+                         count_fish_after)
+from utils import get_puzzle_input
+
+def solve_puzzle(input_string):
+    """Return the numeric solution to the puzzle"""
+    return count_fish_after(convert_input_to_series(input_string), 256)
+
+def main(*argv):
+    """Run when the file is called as a script"""
+    assert solve_puzzle("3,4,3,1,2\n") == 26984457539
+    print("Number of lanternfish after 256 days:",
+          solve_puzzle(get_puzzle_input(6)))
+
+if __name__ == "__main__":
+    import sys
+    main(*sys.argv)
```