def _run_assembler(program, assembler): computer = Computer(program) while not computer.needs_input: computer.step() computer.print_ascii() computer.write_ascii(assembler) while not computer.is_halted: computer.step() return computer.print_ascii()
def _main(): with open(asset("day25.txt")) as file: program = [int(part) for part in file.read().split(',')] computer = Computer(program) commands = [ "south", "take mouse", "north", "west", "north", "north", "north", "west", "take semiconductor", "east", "south", "west", "south", "take hypercube", "north", "east", "south", "west", "take antenna", "west", "south", "south", "south" ] computer.write_ascii("\n".join(commands) + '\n') while not computer.is_halted: while not computer.num_outputs and not computer.is_halted: computer.step() if computer.num_outputs: computer.print_ascii()