示例#1
0
def solution():
    from pathlib import Path
    input_file = Path(INPUT_FILE)
    # parse the sequence of commands and put the value as the computer input
    num_sequence = parse_program(input_file)
    computer = IntcodeComputer(program=num_sequence)
    computer.send_input_data(2)
    # set the input value that we want to pass to the Input command
    computer.run_program()
    return computer.output_buffer.value
示例#2
0
def solution():
    from pathlib import Path
    input_file = Path(INPUT_FILE)
    # parse the sequence of commands and replace two elements with values
    # according to the task
    num_sequence = parse_program(input_file)
    computer = IntcodeComputer(program=num_sequence)
    # set the input value that we want to pass to the Input command
    computer.send_input_data(5)
    computer.run_program()
    return computer.output_buffer.value