Exemple #1
0
    gametab_position = [593, 593, 132, 132]
    select_position = [564, 564, 248, 248]
    disconnect_position = [1184, 1184, 703, 703]
    output_keysList = []

    n_input, tensor_size, lstm_classes, n_hidden, lstm_based_Bots, cnn_classes = cgrAPI.gameBotParamInit(
        1, 20, 5, 512, 0, 1)
    associate_flag, RUNNING_TIME, AI_BOTS_DIR, RESULT_DIR, BIND_CPU, HUMAN_RUN, Reso_Width, Reso_Hight, MultipleMode = cgrAPI.globalParamInit(
    )
    lstmX, lstmPred, lstmInit, lstmSaver, lstmLogPath = cgrAPI.LSTMInit(
        "redeclipse", AI_BOTS_DIR, n_input, tensor_size, lstm_classes,
        n_hidden)
    pic_region, cnnDetection_graph, cnnDetector = cgrAPI.CNNInit(
        "redeclipse", AI_BOTS_DIR, Reso_Width, Reso_Hight, cnn_classes)
    output_file = cgrAPI.logsInit(RESULT_DIR)
    cgrAPI.commandInit("redeclipse", associate_flag, RUNNING_TIME, BIND_CPU,
                       HUMAN_RUN, MultipleMode, 5)

    with mss.mss(display=':0.0') as sct:
        with tf.Session() as lstmSession:
            lstmSession.run(lstmInit)
            if os.path.isfile(lstmLogPath + "checkpoint"):
                lstmSaver.restore(lstmSession, lstmLogPath + "lstm-model")
            with tf.Session(graph=cnnDetection_graph) as cnnSession:
                start_time = time.time()
                cur_time = time.time()
                last_cur_time = cur_time
                while (cur_time - start_time <= RUNNING_TIME) and (HUMAN_RUN
                                                                   == 0):
                    lstm_start = 0
                    lstm_end = 0
                    counter_n = counter_n + 1
Exemple #2
0
    time.sleep(2)
    keyboard_action.mouse_click(XPos)
    time.sleep(1)
    return


if __name__ == '__main__':
    file_name = '../training_data/raw-data/training_data' + str(
        int(time.time())) + '.npy'
    training_data = []
    output_keysList = [0, 0]
    dragPos = [681, 681, 679, 679]
    flag_count = 0
    associate_flag, RUNNING_TIME, AI_BOTS_DIR, RESULT_DIR, BIND_CPU, HUMAN_RUN, Reso_Width, Reso_Hight, MultipleMode = cgrAPI.globalParamInit(
    )
    cgrAPI.commandInit("imhotepvr", associate_flag, RUNNING_TIME, BIND_CPU,
                       HUMAN_RUN, MultipleMode)
    imhotepvrBotActions()

    start_time = time.time()
    cur_time = time.time()
    while (HUMAN_RUN == 0) and (cur_time - start_time <= RUNNING_TIME):
        # click start position
        pyautogui.moveTo(dragPos[0], dragPos[2], duration=0.1)
        if flag_count == 0:
            flag_count += 1
            pyautogui.dragRel(300, 0, duration=1)
            record = [[0, flag_count], [1, 0, 0, 0]]
            training_data.append(record)
        elif flag_count == 1:
            flag_count += 1
            pyautogui.dragRel(-300, 0, duration=1)
Exemple #3
0
if __name__ == '__main__':
    count = 0
    supertuxkart_restart = [985, 985, 1030, 1030]
    lstmInputVec = [0, 0]
    n_input, tensor_size, lstm_classes, n_hidden, lstm_based_Bots, cnn_classes = cgrAPI.gameBotParamInit(
        1, 2, 3, 512, 1, 2)
    associate_flag, RUNNING_TIME, AI_BOTS_DIR, RESULT_DIR, BIND_CPU, HUMAN_RUN, Reso_Width, Reso_Hight, MultipleMode = cgrAPI.globalParamInit(
    )
    lstmX, lstmPred, lstmInit, lstmSaver, lstmLogPath = cgrAPI.LSTMInit(
        "supertuxkart", AI_BOTS_DIR, n_input, tensor_size, lstm_classes,
        n_hidden)
    pic_region, cnnDetection_graph, cnnDetector = cgrAPI.CNNInit(
        "supertuxkart", AI_BOTS_DIR, Reso_Width, Reso_Hight, cnn_classes)
    output_file = cgrAPI.logsInit(RESULT_DIR)
    cgrAPI.commandInit("supertuxkart", associate_flag, RUNNING_TIME, BIND_CPU,
                       HUMAN_RUN, MultipleMode, 3)

    with mss.mss(display=':0.0') as sct:
        with tf.Session() as lstmSession:
            lstmSession.run(lstmInit)
            if os.path.isfile(lstmLogPath + "checkpoint"):
                lstmSaver.restore(lstmSession, lstmLogPath + "lstm-model")

            with tf.Session(graph=cnnDetection_graph) as cnnSession:
                start_time = time.time()
                cur_time = time.time()
                last_cur_time = cur_time
                while ((cur_time - start_time <= RUNNING_TIME)
                       and (HUMAN_RUN == 0)):
                    count += 1
                    print(count)
    position_vec = [0, 1080]
    x_dim = range(786, 1096, 1)
    last_life_value = 0
    retreat_flag = 0
    battle_flag = 0

    n_input, tensor_size, lstm_classes, n_hidden, lstm_based_Bots, cnn_classes = cgrAPI.gameBotParamInit(
        1, 4, 3, 512, 1, 2)
    associate_flag, RUNNING_TIME, AI_BOTS_DIR, RESULT_DIR, BIND_CPU, HUMAN_RUN, Reso_Width, Reso_Hight, MultipleMode = cgrAPI.globalParamInit(
    )
    lstmX, lstmPred, lstmInit, lstmSaver, lstmLogPath = cgrAPI.LSTMInit(
        "dota2", AI_BOTS_DIR, n_input, tensor_size, lstm_classes, n_hidden)
    pic_region, cnnDetection_graph, cnnDetector = cgrAPI.CNNInit(
        "dota2", AI_BOTS_DIR, Reso_Width, Reso_Hight, cnn_classes)
    output_file = cgrAPI.logsInit(RESULT_DIR)
    cgrAPI.commandInit("dota2", associate_flag, RUNNING_TIME, BIND_CPU,
                       HUMAN_RUN, MultipleMode, 10)
    dotaBotActions()

    with mss.mss(display=':0.0') as sct:
        with tf.Session() as lstmSession:
            lstmSession.run(lstmInit)
            if os.path.isfile(lstmLogPath + "checkpoint"):
                lstmSaver.restore(lstmSession, lstmLogPath + "lstm-model")
            with tf.Session(graph=cnnDetection_graph) as cnnSession:
                start_time = time.time()
                cur_time = time.time()
                last_cur_time = cur_time
                while ((cur_time - start_time <= RUNNING_TIME)
                       and (HUMAN_RUN == 0)):
                    lstm_start = 0
                    lstm_end = 0
Exemple #5
0
if __name__ == '__main__':
    inmind_center = [940, 566]  #960,564
    i_counter = 0
    last_drag = 0
    output_keysList = []
    lstmInputVec = [0, 0]
    n_input, tensor_size, lstm_classes, n_hidden, lstm_based_Bots, cnn_classes = cgrAPI.gameBotParamInit(
        1, 2, 3, 512, 1, 3)
    associate_flag, RUNNING_TIME, AI_BOTS_DIR, RESULT_DIR, BIND_CPU, HUMAN_RUN, Reso_Width, Reso_Hight, MultipleMode = cgrAPI.globalParamInit(
    )
    lstmX, lstmPred, lstmInit, lstmSaver, lstmLogPath = cgrAPI.LSTMInit(
        "inmindvr", AI_BOTS_DIR, n_input, tensor_size, lstm_classes, n_hidden)
    pic_region, cnnDetection_graph, cnnDetector = cgrAPI.CNNInit(
        "inmindvr", AI_BOTS_DIR, Reso_Width, Reso_Hight, cnn_classes)
    output_file = cgrAPI.logsInit(RESULT_DIR)
    cgrAPI.commandInit("inmindvr", associate_flag, RUNNING_TIME, BIND_CPU,
                       HUMAN_RUN, MultipleMode, 3)

    with mss.mss(display=':0.0') as sct:
        with tf.Session() as lstmSession:
            lstmSession.run(lstmInit)
            if os.path.isfile(lstmLogPath + "checkpoint"):
                lstmSaver.restore(lstmSession, lstmLogPath + "lstm-model")
            with tf.Session(graph=cnnDetection_graph) as cnnSession:
                start_time = time.time()
                cur_time = time.time()
                last_cur_time = cur_time
                while (cur_time - start_time <= RUNNING_TIME) and (HUMAN_RUN
                                                                   == 0):
                    lstm_start = 0
                    lstm_end = 0
                    pyautogui.moveTo(inmind_center[0], inmind_center[1])