summaryrefslogtreecommitdiffstats
path: root/solutions/py/d09.py
diff options
context:
space:
mode:
authorGustav Sörnäs <gusso230@student.liu.se>2019-12-09 07:26:56 +0100
committerGustav Sörnäs <gusso230@student.liu.se>2019-12-09 09:19:31 +0100
commitf79931b49d78b4a1cd9189a3d14dfc426be8f545 (patch)
tree3cc01026b28e2e13cc4d5fae7afd6a3b43ab80cb /solutions/py/d09.py
parenteb9c3d11134a32323454e36487b0bd67b2fc090c (diff)
downloadaoc-f79931b49d78b4a1cd9189a3d14dfc426be8f545.tar.gz
Day 9 py
Diffstat (limited to 'solutions/py/d09.py')
-rw-r--r--solutions/py/d09.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/solutions/py/d09.py b/solutions/py/d09.py
new file mode 100644
index 0000000..5a8f132
--- /dev/null
+++ b/solutions/py/d09.py
@@ -0,0 +1,13 @@
+import intcode
+
+input = open("../input/09", "r").readlines()[0]
+
+program = [int(x) for x in input.split(",")]
+c = intcode.Computer(program)
+c.input = 2
+while c.memory[c.pointer] != 99:
+ c.step()
+ #print(c.relative_base, c.pointer, c.memory)
+ if c.output is not None:
+ print(c.output)
+ c.output = None