from lib import get_data, str_to_ints from d9 import Amp data = get_data(__file__) xs = str_to_ints(data) script = """NOT A J AND A J NOT C T AND D T OR T J NOT A T OR T J """ a = Amp(xs) while not a.done: a.go() if a.input_required: for c in script: a.feed(ord(c)) for c in "WALK\n": a.feed(ord(c)) while a.outputs: c = a.pop() try: chr(c) # print(chr(c), end="") except ValueError: print(c) script = """NOT C J AND H J NOT A T OR T J NOT B T OR T J AND D J """ a = Amp(xs) while not a.done: a.go() if a.input_required: for c in script: a.feed(ord(c)) for c in "RUN\n": a.feed(ord(c)) while a.outputs: c = a.pop() try: chr(c) # print(chr(c), end="") except ValueError: print(c)