summaryrefslogtreecommitdiffstats
path: root/solutions/py/d09.py
diff options
context:
space:
mode:
Diffstat (limited to 'solutions/py/d09.py')
-rw-r--r--solutions/py/d09.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/solutions/py/d09.py b/solutions/py/d09.py
index 7495d3a..ada6763 100644
--- a/solutions/py/d09.py
+++ b/solutions/py/d09.py
@@ -5,9 +5,11 @@ def do(input, code):
c = intcode.Computer(program)
c.input = code
output = []
- while c.memory[c.pointer] != 99:
+ while True:
c.step()
#print(c.relative_base, c.pointer, c.memory)
+ if c.SIG_HALT:
+ break
if c.output is not None:
output.append(c.output)
c.output = None
@@ -20,10 +22,6 @@ def pt2(input):
return do(input[0], 2)
if __name__ == "__main__":
- import cProfile
-
input = open("../input/09", "r").readlines()
- cProfile.run("pt1(input)")
- cProfile.run("pt2(input)")
print(pt1(input))
print(pt2(input))