diff options
| author | Gustav Sörnäs <gusso230@student.liu.se> | 2019-12-17 18:55:21 +0100 |
|---|---|---|
| committer | Gustav Sörnäs <gusso230@student.liu.se> | 2019-12-17 18:55:21 +0100 |
| commit | ca4d3b189da7793ce8744246617c793c8640ce71 (patch) | |
| tree | 087d23c41ebaa9b22c8211d95e7ce73d1294eb2f /solutions | |
| parent | 189ca3de24bcaa5028767154af555c2194d019ab (diff) | |
| download | aoc-ca4d3b189da7793ce8744246617c793c8640ce71.tar.gz | |
Fix SIG_*-resets
Diffstat (limited to 'solutions')
| -rw-r--r-- | solutions/py/d15.py | 4 | ||||
| -rw-r--r-- | solutions/py/intcode.py | 2 |
2 files changed, 2 insertions, 4 deletions
diff --git a/solutions/py/d15.py b/solutions/py/d15.py index e1de236..b2a9b10 100644 --- a/solutions/py/d15.py +++ b/solutions/py/d15.py @@ -134,7 +134,6 @@ def pt2(input): print("invalid path") break c.input = direction - c.SIG_INPUT = False if c.SIG_OUTPUT: if c.output == 0: board[(cur_x, cur_y)] = "#" @@ -147,7 +146,6 @@ def pt2(input): else: break c.output = None - c.SIG_OUTPUT = False steps = 0 visited = set(oxygen) @@ -238,7 +236,6 @@ def visualize(input): print("invalid path") break c.input = direction - c.SIG_INPUT = False if c.SIG_OUTPUT: if c.output == 0: board[(cur_x, cur_y)] = "#" @@ -253,7 +250,6 @@ def visualize(input): time.sleep(0.005) print(draw(board, droid=(cur_x, cur_y))) c.output = None - c.SIG_OUTPUT = False get_path((0,0), oxygen, board, draw_search=True) diff --git a/solutions/py/intcode.py b/solutions/py/intcode.py index daaf12d..694fee0 100644 --- a/solutions/py/intcode.py +++ b/solutions/py/intcode.py @@ -87,6 +87,8 @@ class Computer(object): def step(self): if self.SIG_OUTPUT and self.output is None: self.SIG_OUTPUT = False + if self.SIG_INPUT and self.input is not None: + self.SIG_INPUT = False inst = self.parse_op(self.memory[self.pointer]) if inst[0] == HAL: |
