diff --git a/2016/day10.py b/2016/day10.py index 13da087..c5363d0 100644 --- a/2016/day10.py +++ b/2016/day10.py @@ -1,7 +1,7 @@ import re import fileinput from collections import defaultdict -from utils import parse_line, mul +from utils import parse_line BOTS = defaultdict(list) OUTPUTS = defaultdict(list) @@ -18,12 +18,12 @@ while INSTRUCTIONS: else: bot, low_t, low, high_t, high = parse_line(r'bot (\d+) .+ (\w+) (\d+) .+ (\w+) (\d+)', line) - if bot not in BOTS or len(BOTS[bot]) != 2: + if bot not in BOTS or len(BOTS[bot]) < 2: temp.append(line) continue if 17 in BOTS[bot] and 61 in BOTS[bot]: - print "Bot #%i compares 17 and 61." % bot + print "Bot #%i compares values 17 and 61." % bot l, h = sorted(BOTS[bot][:2]) BOTS[bot] = [] @@ -34,5 +34,5 @@ while INSTRUCTIONS: INSTRUCTIONS = temp temp = [] -product = mul(OUTPUTS[i][0] for i in range(3)) -print "Product of values in outputs 0-2 is %i." % product +a, b, c = (OUTPUTS[i][0] for i in range(3)) +print "Product of values in outputs 0-2 is %i." % (a * b * c)