Browse Source

Correcting type hints and black reformatting

pull/6/head
Ryan Reed 3 years ago
parent
commit
9bb3b71da3
1 changed files with 6 additions and 6 deletions
  1. +6
    -6
      puzzles/day06.py

+ 6
- 6
puzzles/day06.py View File

@ -18,22 +18,22 @@ class Reproduce:
def __init__(self, times: List[int]) -> None:
self.times = times
def start(self, days: int=80) -> None:
def start(self, days: int = 80) -> None:
counts = Counter(self.times)
for day in range(days):
next_counts = Counter() # Can't modify while iterating
next_counts = Counter() # Can't modify while iterating
for count_key, count in counts.items():
if count_key == 0:
next_counts[6] += count # Move the parents back to 6 days
next_counts[8] += count # Add the new fish
next_counts[6] += count # Move the parents back to 6 days
next_counts[8] += count # Add the new fish
else:
next_counts[count_key - 1] += count # Move count to next day count
next_counts[count_key - 1] += count # Move count to next day count
counts = next_counts
self.time_counts = counts
def count_fish(self):
def count_fish(self) -> int:
return sum(self.time_counts.values())


Loading…
Cancel
Save