Skip to content

Instantly share code, notes, and snippets.

@spielkind
Last active December 6, 2021 13:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spielkind/73d02d389752c0508cc9d7601fb2ec5f to your computer and use it in GitHub Desktop.
Save spielkind/73d02d389752c0508cc9d7601fb2ec5f to your computer and use it in GitHub Desktop.
#!/bin/python
fish = [0] * 9
with open('day6.txt') as f:
for timer in map(int, next(f).strip().split(',')):
fish[timer] += 1
for days in range(256):
nextdayfish = [0] * 9
spawn = fish[0]
for i in range(1, 9):
fish[i-1] = fish[i]
fish[8] = spawn
fish[6] += spawn
print('Fish:',sum(fish))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment