Ejemplo n.º 1
0
def judge_eva4(my_pick, el_pick, hero_to_use):
    hero_power = eva.get_hero_power()
    hero_my_choose = get_in_road_choose(hero_to_use, my_pick)
    hero_el_choose = get_in_road_choose(hero_to_use, el_pick)
    tmp = -100
    for i in hero_my_choose:
        l_my1 = my_pick.copy()
        l_my1.append(i)
        c_my1 = get_in_road_choose(hero_my_choose, l_my1)
        for j in hero_el_choose:
            l_el1 = el_pick.copy()
            l_el1.append(j)
            c_el1 = get_in_road_choose(hero_el_choose, l_el1)
            for l in c_el1:
                l_el2 = l_el1.copy()
                l_el2.append(l)
                for k in c_my1:
                    l_my2 = l_my1.copy()
                    l_my2.append(k)
                    evaluation = eva.evaluate(l_my2) - eva.evaluate(l_el2)
                    if evaluation > tmp:
                        tmp = evaluation
                        hero = i
    power = 0
    for i in list(hero_power[hero].values()):
        if i > power:
            power = i
    return hero, int(power * 100)
Ejemplo n.º 2
0
def judge_eva1(my_pick, el_pick, hero_to_use):
    hero_power = eva.get_hero_power()
    hero_my_choose = get_in_road_choose(hero_to_use, my_pick)
    tmp = 0
    for i in hero_my_choose:
        l_my1 = my_pick.copy()
        l_my1.append(i)
        evaluation = eva.evaluate(l_my1)
        if evaluation > tmp:
            tmp = evaluation
            hero = i
    power = 0
    for i in list(hero_power[hero].values()):
        if i > power:
            power = i
    return hero, int(power * 100)
Ejemplo n.º 3
0
def pick_ai_input(dire, ban, pick):
    """ai在此bp过程中的选用"""
    # 下为所需的材料建立
    if True:
        hero_name = data.get_hero_name()
        powerful = data.get_powerful()
        hero_to_choose = del_list_no_use(hero_name, ban, pick)
        powerful = del_diy_no_use(powerful, ban, pick)
        hero_power = eva.get_hero_power()
        hero = p_choose(hero_to_choose)

        red_pick, blue_pick = get_pick(pick)
        hero_blue_choose = get_in_road_choose(hero_to_choose, blue_pick)
        hero_red_choose = get_in_road_choose(hero_to_choose, red_pick)

    def get_most_powerful():
        tmp = 0
        for i in powerful.keys():
            if powerful[i] > tmp:
                tmp = powerful[i]
                tmp_i = i
        return tmp_i, powerful[tmp_i]

    # 下为蓝方选用函数
    if True:

        def pick_blue1():
            nonlocal hero
            temp_l = {}
            # 第一候选人
            temp1, coef1 = judge_eva1(blue_pick, red_pick, hero_to_choose)
            temp_l[temp1] = coef1
            # 第二候选人
            temp2, coef2 = get_most_powerful()
            if temp2 in temp_l.keys():
                temp_l[temp2] += int(coef2)
            else:
                temp_l[temp2] = int(coef2)
            # 第三候选人
            temp3, coef3 = judge_system(blue_pick, hero_to_choose)
            if temp3 in temp_l.keys():
                temp_l[temp3] += int(coef3)
            else:
                temp_l[temp3] = int(coef3)
            # 第四候选人
            temp4, coef4 = judge_restrain(red_pick, hero_to_choose)
            if temp4 in temp_l.keys():
                temp_l[temp4] += int(coef4)
            else:
                temp_l[temp4] = int(coef4)
            # 候选人竞选
            hero = p_choose(temp_l)
            return

        def pick_blue2():
            nonlocal hero
            temp_l = {}
            # 第一候选人
            temp1, coef1 = judge_eva1(blue_pick, red_pick, hero_to_choose)
            temp_l[temp1] = coef1
            # 第二候选人
            temp2, coef2 = get_most_powerful()
            if temp2 in temp_l.keys():
                temp_l[temp2] += int(coef2 * 0.9)
            else:
                temp_l[temp2] = int(coef2 * 0.9)
            # 第三候选人
            temp3, coef3 = judge_system(blue_pick, hero_to_choose)
            if temp3 in temp_l.keys():
                temp_l[temp3] += int(coef3)
            else:
                temp_l[temp3] = int(coef3)
            # 第四候选人
            temp4, coef4 = judge_restrain(red_pick, hero_to_choose)
            if temp4 in temp_l.keys():
                temp_l[temp4] += int(coef4)
            else:
                temp_l[temp4] = int(coef4)
            # 候选人竞选
            hero = p_choose(temp_l)
            return

        def pick_blue3():
            nonlocal hero
            temp_l = {}
            # 第一候选人
            temp1, coef1 = judge_eva1(blue_pick, red_pick, hero_to_choose)
            temp_l[temp1] = coef1
            # 第二候选人
            temp2, coef2 = get_most_powerful()
            if temp2 in temp_l.keys():
                temp_l[temp2] += int(coef2 * 0.8)
            else:
                temp_l[temp2] = int(coef2 * 0.8)
            # 第三候选人
            temp3, coef3 = judge_system(blue_pick, hero_to_choose)
            if temp3 in temp_l.keys():
                temp_l[temp3] += int(coef3)
            else:
                temp_l[temp3] = int(coef3)
            # 第四候选人
            temp4, coef4 = judge_restrain(red_pick, hero_to_choose)
            if temp4 in temp_l.keys():
                temp_l[temp4] += int(coef4)
            else:
                temp_l[temp4] = int(coef4)
            # 候选人竞选
            hero = p_choose(temp_l)
            return

        def pick_blue4():
            nonlocal hero
            temp_l = {}
            # 第一候选人
            temp1, coef1 = judge_eva1(blue_pick, red_pick, hero_to_choose)
            temp_l[temp1] = coef1
            # 第一候选人
            temp2, coef2 = get_most_powerful()
            if temp2 in temp_l.keys():
                temp_l[temp2] += int(coef2 * 0.6)
            else:
                temp_l[temp2] = int(coef2 * 0.6)
            # 第三候选人
            temp3, coef3 = judge_system(blue_pick, hero_to_choose)
            if temp3 in temp_l.keys():
                temp_l[temp3] += int(coef3)
            else:
                temp_l[temp3] = int(coef3)
            # 第四候选人
            temp4, coef4 = judge_restrain(red_pick, hero_to_choose)
            if temp4 in temp_l.keys():
                temp_l[temp4] += int(coef4)
            else:
                temp_l[temp4] = int(coef4)
            # 候选人竞选
            hero = p_choose(temp_l)
            return

        def pick_blue5():
            nonlocal hero
            temp_l = {}
            # 第一候选人
            temp1, coef1 = judge_eva1(blue_pick, red_pick, hero_to_choose)
            temp_l[temp1] = coef1
            # 第二候选人
            temp2, coef2 = get_most_powerful()
            if temp2 in temp_l.keys():
                temp_l[temp2] += int(coef2 * 0.5)
            else:
                temp_l[temp2] = int(coef2 * 0.5)
            # 第三候选人
            temp3, coef3 = judge_system(blue_pick, hero_to_choose)
            if temp3 in temp_l.keys():
                temp_l[temp3] += int(coef3)
            else:
                temp_l[temp3] = int(coef3)
            # 第四候选人
            temp4, coef4 = judge_restrain(red_pick, hero_to_choose)
            if temp4 in temp_l.keys():
                temp_l[temp4] += int(coef4)
            else:
                temp_l[temp4] = int(coef4)
            # 候选人竞选
            hero = p_choose(temp_l)
            return

    # 下为红方选用函数
    if True:

        def pick_red1():
            nonlocal hero
            temp_l = {}
            # 第一候选人
            temp1, coef1 = judge_eva1(red_pick, blue_pick, hero_to_choose)
            temp_l[temp1] = coef1
            # 第二候选人
            temp2, coef2 = get_most_powerful()
            if temp2 in temp_l.keys():
                temp_l[temp2] += int(coef2)
            else:
                temp_l[temp2] = int(coef2)
            # 第三候选人
            temp3, coef3 = judge_system(red_pick, hero_to_choose)
            if temp3 in temp_l.keys():
                temp_l[temp3] += int(coef3)
            else:
                temp_l[temp3] = int(coef3)
            # 第四候选人
            temp4, coef4 = judge_restrain(blue_pick, hero_to_choose)
            if temp4 in temp_l.keys():
                temp_l[temp4] += int(coef4)
            else:
                temp_l[temp4] = int(coef4)
            # 候选人竞选
            hero = p_choose(temp_l)
            return

        def pick_red2():
            nonlocal hero
            temp_l = {}
            # 第一候选人
            temp1, coef1 = judge_eva2(red_pick, blue_pick, hero_to_choose)
            temp_l[temp1] = coef1
            # 第二候选人
            temp2, coef2 = get_most_powerful()
            if temp2 in temp_l.keys():
                temp_l[temp2] += int(coef2 * 0.9)
            else:
                temp_l[temp2] = int(coef2 * 0.9)
            # 第三候选人
            temp3, coef3 = judge_system(red_pick, hero_to_choose)
            if temp3 in temp_l.keys():
                temp_l[temp3] += int(coef3)
            else:
                temp_l[temp3] = int(coef3)
            # 第四候选人
            temp4, coef4 = judge_restrain(blue_pick, hero_to_choose)
            if temp4 in temp_l.keys():
                temp_l[temp4] += int(coef4)
            else:
                temp_l[temp4] = int(coef4)
            # 候选人竞选
            hero = p_choose(temp_l)
            return

        def pick_red3():
            nonlocal hero
            temp_l = {}
            # 第一候选人
            temp1, coef1 = judge_eva1(red_pick, blue_pick, hero_to_choose)
            temp_l[temp1] = coef1
            # 第二候选人
            temp2, coef2 = get_most_powerful()
            if temp2 in temp_l.keys():
                temp_l[temp2] += int(coef2 * 0.8)
            else:
                temp_l[temp2] = int(coef2 * 0.8)
            # 第三候选人
            temp3, coef3 = judge_system(red_pick, hero_to_choose)
            if temp3 in temp_l.keys():
                temp_l[temp3] += int(coef3)
            else:
                temp_l[temp3] = int(coef3)
            # 第四候选人
            temp4, coef4 = judge_restrain(blue_pick, hero_to_choose)
            if temp4 in temp_l.keys():
                temp_l[temp4] += int(coef4)
            else:
                temp_l[temp4] = int(coef4)
            # 候选人竞选
            hero = p_choose(temp_l)
            return

        def pick_red4():
            nonlocal hero
            temp_l = {}
            # 第一候选人
            temp1, coef1 = judge_eva2(red_pick, blue_pick, hero_to_choose)
            temp_l[temp1] = coef1
            # 第二候选人
            temp2, coef2 = get_most_powerful()
            if temp2 in temp_l.keys():
                temp_l[temp2] += int(coef2 * 0.5)
            else:
                temp_l[temp2] = int(coef2 * 0.5)
            # 第三候选人
            temp3, coef3 = judge_system(red_pick, hero_to_choose)
            if temp3 in temp_l.keys():
                temp_l[temp3] += int(coef3)
            else:
                temp_l[temp3] = int(coef3)
            # 第四候选人
            temp4, coef4 = judge_restrain(blue_pick, hero_to_choose)
            if temp4 in temp_l.keys():
                temp_l[temp4] += int(coef4)
            else:
                temp_l[temp4] = int(coef4)
            # 候选人竞选
            hero = p_choose(temp_l)
            return

        def pick_red5():
            nonlocal hero
            temp_l = {}
            # 第一候选人
            temp1, coef1 = judge_eva1(red_pick, blue_pick, hero_to_choose)
            temp_l[temp1] = coef1
            # 第二候选人
            temp2, coef2 = get_most_powerful()
            if temp2 in temp_l.keys():
                temp_l[temp2] += int(coef2 * 0.5)
            else:
                temp_l[temp2] = int(coef2 * 0.5)
            # 第三候选人
            temp3, coef3 = judge_system(red_pick, hero_to_choose)
            if temp3 in temp_l.keys():
                temp_l[temp3] += int(coef3)
            else:
                temp_l[temp3] = int(coef3)
            # 第四候选人
            temp4, coef4 = judge_restrain(blue_pick, hero_to_choose)
            if temp4 in temp_l.keys():
                temp_l[temp4] += int(coef4)
            else:
                temp_l[temp4] = int(coef4)
            # 候选人竞选
            hero = p_choose(temp_l)
            return

    # 下为蓝方选用
    if True:
        if len(pick) == 0:
            """蓝方第一选"""
            pick_blue1()
        elif len(pick) == 3:
            """蓝方第二选,需与第三选关联"""
            pick_blue2()
        elif len(pick) == 4:
            """蓝方第三选,需与第二选关联"""
            pick_blue3()
        elif len(pick) == 7:
            """蓝方第四选,需与第五选关联"""
            pick_blue4()
        elif len(pick) == 8:
            """蓝方第五选,需与第四选关联"""
            pick_blue5()
    # 下为红方选用
    if True:
        if len(pick) == 1:
            """红方第一选,需与第二选关联"""
            pick_red1()
        elif len(pick) == 2:
            """红方第二选,需与第一选关联"""
            pick_red2()
        elif len(pick) == 5:
            """红方第三选,counter_pick"""
            pick_red3()
        elif len(pick) == 6:
            """红方第四选"""
            pick_red4()
        elif len(pick) == 9:
            """红方第五选,counter_pick"""
            pick_red5()
    return hero