img = cv2.imread("./autojump.png") score, pos = check_result.check_result(img) if score >= 0: with open("./result.txt", a) as f: f.write("score:", score) f.write("\n") os.system( "cd ../dependency/platform-tools-windows && ./adb.exe shell input tap " + str(pos[0]) + ' ' + str(pos[1])) pass if mType is '0': # python print("python start") import jump_python.jumper as j dis = j.jumper() # print(dis) pass elif mType is '1': # cpp if os.path.isfile("./jump_cpp/output.txt"): os.remove("./jump_cpp/output.txt") os.system("cd jump_cpp && jumper.exe") with open("./jump_cpp/output.txt") as f: dis = f.readlines(0)[0] pass elif mType is '2': # matlab eng = matlab.engine.start_matlab() eng.addpath("./jump_matlab", nargout=0) dis = eng.jumper()
+ str(pos[0]) + ' ' + str(pos[1])) while True: get_screenshot() screenshot = cv2.imread('./autojump.png') score, restart_pos = check.check_result(screenshot) if score >= 0: with open("./result.txt", 'a') as f: f.write("score: ", score) f.write("\n") restart(restart_pos) press_time = 0 if lang == "python": press_time = jumper.jumper() elif lang == "cpp": if platform == "win32": press_time = subprocess.getoutput('cd jump_cpp && jumper.exe') if platform == "darwin": press_time = subprocess.getoutput('cd jump_cpp && ./jumper') else: engine.addpath("./jump_matlab") press_time = engine.jumper() print('Press time: ' + str(press_time)) press_screen(press_time) time.sleep(2)