aoc

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

commit 5df4492ab1fdedff494e953fea91a937ecb29a84 (patch)
parent c3251b507fca55b469bc89cee97b406c26b38148
Author: Alex Karle <alex@alexkarle.com>
Date:   Sat, 11 Dec 2021 12:41:05 -0500

day8: Remove debug prints, compute sum in-script

I was so tired at the point of doing these... I just piped it to my
"csum" program for pt b :)

Diffstat:
M8/a.py | 1-
M8/b.py | 8+++++++-
2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/8/a.py b/8/a.py @@ -10,7 +10,6 @@ for l in sys.stdin: elif not seen: continue if len(sig) == 2 or len(sig) == 7 or len(sig) == 4 or len(sig) == 3: - print(sig, count) count += 1 print(count) diff --git a/8/b.py b/8/b.py @@ -5,6 +5,7 @@ import sys # Map abcdefg -> 1234567 (orig positions) def mapit(preface): M = {} + def mset(sig, val): if val in M: print(val) @@ -67,6 +68,7 @@ def contains(sig, M, query): return False return True + def contained(sig, M, query): if query not in M: return False @@ -76,6 +78,8 @@ def contained(sig, M, query): return False return True + +total = 0 for l in sys.stdin: # Sort into two buckets per line seen = False @@ -99,4 +103,6 @@ for l in sys.stdin: for m, v in M.items(): if s == v: out += m - print(out) + total += int(out) + +print(total)