diff options
| author | Gustav Sörnäs <gusso230@student.liu.se> | 2019-12-21 14:06:16 +0100 |
|---|---|---|
| committer | Gustav Sörnäs <gusso230@student.liu.se> | 2019-12-21 20:29:34 +0100 |
| commit | b672158dc1ccd12b5615fbfe03524e979ef4da52 (patch) | |
| tree | 8200ee73880df649a5cc0dda163e6be0f0e77348 /19/py/d21.py | |
| parent | 8a6142b323462587e2feead3ba56efef280d0654 (diff) | |
| download | aoc-b672158dc1ccd12b5615fbfe03524e979ef4da52.tar.gz | |
Day 21 part 2
Diffstat (limited to '19/py/d21.py')
| -rw-r--r-- | 19/py/d21.py | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/19/py/d21.py b/19/py/d21.py index 3b2e123..b4ad1eb 100644 --- a/19/py/d21.py +++ b/19/py/d21.py @@ -1,14 +1,3 @@ -# program and idea for part 1: -# jump if any tile of the first three aren't ground and the fourth is ground -# J = (not A or not B or not C) and D -# (dm) <=> J = not (A and B and C) and D -# or A T -# and B T -# and C T -# not T J -# and D J -# walk - import intcode f = open("../input/21", "r").readlines() @@ -27,19 +16,14 @@ def ascii_draw(a): print("[INVALID ASCII]", c) return s +jumpscript = open("21.js", "r").readlines() +for line in jumpscript: + if line[0] != "#": + c.queue_ascii(line.strip().upper()) + print(line.strip().upper()) + while not c.SIG_HALT: c.step() - if c.SIG_INPUT: - # flush output - print(ascii_draw(output)) - output = [] - if len(output) > 0: - output = [] - while True: - s = input() - if s.upper() == "END": - break - c.queue_ascii(s.upper()) if c.SIG_OUTPUT: output.append(c.output) c.output = None |
