def part_one(code: list[int]) -> None: machine: IntCode.Machine = IntCode.Machine(code, [1]) machine.run() if any(machine.output_vals[:-1]): print(f"Failed tests: {machine.output_vals}") else: print(machine.output_vals[-1])
def run(code: list[int], x: int) -> int: machine: IntCode.Machine = IntCode.Machine(code, [x]) machine.run() [ans] = machine.output_vals return ans
def run_with_noun_verb(code: list[int], noun: int, verb: int) -> int: machine: IntCode.Machine = IntCode.Machine(code) machine.code[1] = noun machine.code[2] = verb machine.run() return machine.code[0]
def part_two(code: list[int]) -> None: machine: IntCode.Machine = IntCode.Machine(code, [5]) machine.run() print(machine.output_vals[-1])