aoc

Advent of Code Solutions
git clone git://git.alexkarle.com.com/aoc
Log | Files | Refs | README | LICENSE

commit 69bfaf2d84d210ba563a8f789345667aa34867c0 (patch)
parent 3c39a9143cad06f3e05d3c7478d8313380003361
Author: Alex Karle <alex@alexkarle.com>
Date:   Mon,  6 Dec 2021 10:08:26 -0500

day6: Clean up b.py

Diffstat:
M6/b.py | 18+++---------------
1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/6/b.py b/6/b.py @@ -2,23 +2,11 @@ import sys # rather than keep a raw list, count number of each type! -counts = [0, 0, 0, 0, 0, 0, 0, 0, 0] - -def repro(fish): - new = [] - for f in fish: - if f == 0: - new += [6, 8] - else: - new.append(f - 1) - - return new +counts = [0] * 9 for l in sys.stdin: - # just keep the last one (only one) - fish = [int(x) for x in l.split(',')] - for f in fish: - counts[f] += 1 + for f in l.split(","): + counts[int(f)] += 1 for i in range(256): ready = counts.pop(0)