From 6cd82b1daeb07d5643dedb24ec828eabd645510b Mon Sep 17 00:00:00 2001 From: Arne Wischer Date: Thu, 12 Dec 2019 18:32:30 +0100 Subject: [PATCH] First try on day 8 --- days/day8.py | 20 ++++++++++++++++++++ days/input/day8_input | 1 + 2 files changed, 21 insertions(+) create mode 100644 days/day8.py create mode 100644 days/input/day8_input diff --git a/days/day8.py b/days/day8.py new file mode 100644 index 0000000..dedf124 --- /dev/null +++ b/days/day8.py @@ -0,0 +1,20 @@ +import unittest +import os + + +class Day8(unittest.TestCase): + inputfile = os.path.join(os.path.dirname(__file__), "input/day8_input") + + def test_day8a(self): + width = 3 + height = 2 + with open(self.inputfile) as fp: + img = [int(k) for k in str(fp.readline())] + + layers = [img[b:e] for b, e in zip([0, 6], [6, 12])] + for l in layers: + print(l.count(0)) + + +if __name__ == "__main__": + Day8().test_day8a() diff --git a/days/input/day8_input b/days/input/day8_input new file mode 100644 index 0000000..4d38188 --- /dev/null +++ b/days/input/day8_input @@ -0,0 +1 @@ +123456789012 \ No newline at end of file