Ejemplo n.º 1
0
#!/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])
Ejemplo n.º 2
0
#!/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])))
Ejemplo n.º 3
0
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
Ejemplo n.º 4
0
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)
Ejemplo n.º 5
0
def deploy_drone(program, x, y):
    return next(run_inputs(program, [x, y]))