Ejemplo n.º 1
0
def run(prog, instr):
    intcode = IntCode(prog[:], [instr])
    intcode.running = True

    while intcode.running:
        intcode.run_program()

    return intcode.output_buffer[-1]
Ejemplo n.º 2
0
def part_2():
    input_file = open("resources/09input.txt")
    my_prog = [int(a) for a in input_file.read().strip().split(",")]
    input_file.close()
    intcode = IntCode(my_prog, [2], 2000)
    intcode.running = True

    while intcode.running:
        intcode.run_program()

    # print(intcode.output_buffer)
    return intcode.output_buffer[0]