print("Init timeout") sys.exit(1) while not sim.isTerminated(): sensor = sim.getSensorValues() start = datetime.now() result = sol.getInstructionGPS( pos) if GPS_ONLY else sol.getInstruction(sensor) end = datetime.now() if (end - start).total_seconds() > instructionLimit: print("Instruction timeout") sys.exit(1) if type(result) == tuple: instruction, visData = result else: instruction = result visData = None (pos, realInstruction) = sim.makeInstruction(instruction) history.append((instruction, realInstruction, sensor, pos, sim.getScore(), visData)) print("Solution found in " + str(len(history)) + " steps. Overall score: " + str(round(sim.getScore(), 3))) if not NO_VIS: from Visualization import Visualization vis = Visualization(env, startPos, history) vis.run()