advent-of-code-2019/day21.py

32 lines
405 B
Python

#!/usr/bin/env python3
from intcode import preproc
from lib import last
logic1 = """\
NOT A J
NOT B T
OR T J
NOT C T
OR T J
AND D J
"""
logic2 = logic1 + """\
NOT I T
NOT T T
OR F T
AND E T
OR H T
AND T J
"""
def partI(exe):
log = logic1 + 'WALK\n'
return last(exe(input_iter = map(ord, log)))
def partII(exe):
log = logic2 + 'RUN\n'
return last(exe(input_iter = map(ord, log)))