#!/usr/bin/env python3 import sys from intcode import read_program, run_inputs program = read_program(sys.stdin) print(list(run_inputs(program, [1]))[-1]) print(list(run_inputs(program, [5]))[-1])
#!/usr/bin/env python3 import sys from intcode import read_program, run_inputs program = read_program(sys.stdin) print(next(run_inputs(program, [1]))) print(next(run_inputs(program, [2])))
def rescue(program, main, subs): lines = [main, subs['A'], subs['B'], subs['C'], 'n'] inputs = map(ord, ('\n'.join(lines) + '\n')) for output in run_inputs(program, inputs): pass return output
def run_springscript(program, script): inputs = map(ord, script.lstrip()) interp = run_inputs(program, inputs) return next(out for out in interp if out > 128)
def deploy_drone(program, x, y): return next(run_inputs(program, [x, y]))