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

```commit ce2777308aac33df83c0371bed66a57b772174a1
parent 9f04e689b1bea48107ab1139ed55a92981a1e28b
Date:   Wed,  1 Dec 2021 19:04:20 -0500

Cleaning things up and making them more functional

Diffstat:
Mday01_part1.py | 15+++++++--------
Mday01_part2.py | 29+++++++++++++++--------------
```
```2 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/day01_part1.py b/day01_part1.py
@@ -30,12 +30,11 @@ def count_depth_increases(depth_diff_series):
increases"""
return (depth_diff_series > 0).sum()

-if __name__ == "__main__":
-    """Download the data, find the answer, and print it to the terminal"""
-
-    depth_data['depth_diff'] = calculate_depth_diffs(depth_data['depth'])
+def solve_puzzle():
+    """Return the numeric solution to the puzzle"""
+    return count_depth_increases(
+    )

-    number_of_increases = count_depth_increases(depth_data['depth_diff'])
-
-    print(f'{number_of_increases = }')
+if __name__ == "__main__":
+    print("Number of depth increases:", solve_puzzle())
diff --git a/day01_part2.py b/day01_part2.py
@@ -7,25 +7,26 @@ before calculating diffs as before."""
# that I can just `import` a previous solution and get any useful definitions
# from there (though I'll try to be mindful of what should go into `utils.py`.

+                         calculate_depth_diffs,
+                         count_depth_increases)

def calculate_sliding_sum(depth_series):
"""Given a pandas series of depths, returns a new series where each element
has been replaced by the sum of that element and the preceding two
elements"""
+    # It's not actually necessary to calculate the rolling sum to solve the
+    # puzzle, but this is great pandas practice for me
return depth_series.rolling(window=3).sum()

-if __name__ == "__main__":
-    """Download the data, find the answer, and print it to the terminal"""
-
-    depth_data['depth_rolling_sum'] = \
-        calculate_sliding_sum(depth_data['depth'])
-
-    depth_data['depth_rolling_sum_diff'] = \
-        calculate_depth_diffs(depth_data['depth_rolling_sum'])
+def solve_puzzle():
+    """Return the numeric solution to the puzzle"""
+    return count_depth_increases(
+        calculate_depth_diffs(