Exemplo n.º 1
0
def Play():
    flag = ""
    while True:
        scr = get_screenshot()
        expr = recognize(scr)
        print(expr, eval(expr))
        if flag == expr:
            continue
        else:
            flag = expr
            if eval(expr):
                os.system("adb shell input tap 300 1500")
            else:
                os.system("adb shell input tap 800 1500")
def Play():
    m = PyMouse()
    flag = ""
    while True:
        # start = time.perf_counter()
        time.sleep(0.1)
        try:
            scr = get_screenshot()
            expr = recognize(scr)
            print(expr, eval(expr))
            if flag == expr:
                continue
            else:
                flag = expr
                if eval(expr):
                    m.click(loc['click_true_x'], loc['click_true_y'], 1)
                else:
                    m.click(loc['click_false_x'], loc['click_false_y'], 1)
        except:
            if 'scr' in vars():
                scr.save('failed.png')
            print('Error occurred: ')
            print(traceback.print_exc())
Exemplo n.º 3
0
def Play():
    m = PyMouse()
    flag = ""
    while True:
        # start = time.perf_counter()
        time.sleep(0.1)
        try:
            scr = get_screenshot()
            expr = recognize(scr)
            print(expr, eval(expr))
            if flag == expr:
                continue
            else:
                flag = expr
                if eval(expr):
                    m.click(loc['click_true_x'], loc['click_true_y'], 1)
                else:
                    m.click(loc['click_false_x'], loc['click_false_y'], 1)
        except:
            if 'scr' in vars():
                scr.save('failed.png')
            print('Error occurred: ')
            print(traceback.print_exc())