summaryrefslogtreecommitdiffstats
path: root/solutions/py/d05.py
diff options
context:
space:
mode:
Diffstat (limited to 'solutions/py/d05.py')
-rw-r--r--solutions/py/d05.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/solutions/py/d05.py b/solutions/py/d05.py
new file mode 100644
index 0000000..446bcd6
--- /dev/null
+++ b/solutions/py/d05.py
@@ -0,0 +1,26 @@
+import intcode
+
+def pt1(input):
+ program = [int(x) for x in input[0].split(",")]
+ c = intcode.Computer(program)
+ c.input = 1
+ output = []
+ while c.memory[c.pointer] != 99:
+ c.step()
+ if c.output != None:
+ output.append(c.output)
+ c.output = None
+ return output
+
+def pt2(input):
+ program = [int(x) for x in input[0].split(",")]
+ c = intcode.Computer(program)
+ c.input = 5
+ output = []
+ while c.memory[c.pointer] != 99:
+ c.step()
+ if c.output != None:
+ output.append(c.output)
+ c.output = None
+ return output
+