summaryrefslogtreecommitdiffstats
path: root/solutions/py/d08.py
diff options
context:
space:
mode:
authorGustav Sörnäs <gusso230@student.liu.se>2019-12-08 22:10:51 +0100
committerGustav Sörnäs <gusso230@student.liu.se>2019-12-08 22:10:51 +0100
commit2e74b1b0caeb0e0490c563635af6bef28a990ec6 (patch)
treeebd0fd46184e66db70d2e95fc3cf6e47e2fafe15 /solutions/py/d08.py
parentd8f929604f18cacc40eec80f3bbd4386757a4902 (diff)
downloadaoc-2e74b1b0caeb0e0490c563635af6bef28a990ec6.tar.gz
Add cProfiler
Diffstat (limited to 'solutions/py/d08.py')
-rw-r--r--solutions/py/d08.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/solutions/py/d08.py b/solutions/py/d08.py
index 659bc3a..07a5af3 100644
--- a/solutions/py/d08.py
+++ b/solutions/py/d08.py
@@ -1,13 +1,11 @@
def count(layer, num):
return sum([row.count(num) for row in layer])
-
def pt1(input):
img = []
least_zeroes = 150 # max
n = 0
for l in range(100):
- #print("l", l)
layer = [[int(input[0][l*25*6 + y*25 + x]) for x in range(25)] for y in range(6)]
if count(layer, 0) < least_zeroes:
least_zeroes = count(layer, 0)
@@ -29,3 +27,11 @@ def pt2(input):
str_res.append('\u2588' if c == 1 else ' ')
str_res.append("\n")
return "\n" + ("".join(str_res))
+
+if __name__ == "__main__":
+ import cProfile
+
+ input = open("../input/08", "r").readlines()
+ pt1(input)
+ cProfile.run("pt1(input)")
+ cProfile.run("pt2(input)")