Exemplo n.º 1
0
def F19(livequeue=None, finallivequeue=None):
    print(
        """===================================F19组比赛=============================="""
    )
    fileList = os.listdir("F19players")
    if "__pycache__" in fileList:
        fileList.remove("__pycache__")
    ####F19 first比赛####
    f = Figlet()
    print(f.renderText("             2 0 4 8     F19"))
    print(
        """===================================F19 第一场============================="""
    )
    s = input("Please input 1 to start match F19 first : ")
    while s != "1":
        if s == "Break":
            sys.exit(0)
        s = input("Please input 1 to start match F19 first : ")
    players1 = []
    players2 = []
    players = []

    def f(string):
        if string[-1] == ".":
            return string[0]
        else:
            return string

    for i in range(len(fileList)):
        if int(f(fileList[i][6:8])) > 4 and int(f(fileList[i][6:8])) < 9:
            players1.append("F19players" + "/" + fileList[i])
        elif (int(f(fileList[i][6:8])) > 8 and int(f(fileList[i][6:8])) < 13):
            players2.append("F19players" + "/" + fileList[i])
        else:
            players.append("F19players" + "/" + fileList[i])
    seed = [0, 1, 2, 3]
    shuffle(seed)
    players2 = [players2[i] for i in seed]
    allplayerlist1 = []
    for i in range(4):
        everypair = []
        everypair.append(players1[i])
        everypair.append(players2[i])
        allplayerlist1.append(everypair)

    nextstage1 = []
    path = mkdir('F19 first result')
    pool = Pool()
    nextstage1 = pool.map(
        newmain,
        [(allplayerlist1[i],
          path + "/" + inf.information[allplayerlist1[i][0][11:-3]] + " " +
          "vs" + " " + inf.information[allplayerlist1[i][1][11:-3]], livequeue,
          True, True, True, False, c.REPEAT, c.MAXTIME, c.ROUNDS)
         for i in range(len(allplayerlist1))])
    pool.close()
    pool.join()
    #print(nextstage1)
    f = open(path + '/' + "winners F19 first.txt", 'w')
    f.write("F19 first winners:" + "\n")
    for i in range(len(nextstage1)):
        f.write(inf.information[nextstage1[i][11:-3]] + "\n")
    f.close()
    s = input("是否显示出线小组详细信息 (Y or N) : ")
    print(
        """=========================================================================="""
    )
    f = Figlet()
    print(f.renderText("Congratulations"))
    print(
        """===================================F19 第一场结果=========================="""
    )
    while s != "N":
        if s == "Y":
            print(
                "                                恭喜以下小组同学出线!                                  "
            )
            for i in range(len(nextstage1)):
                print("                                " +
                      inf.information[nextstage1[i][11:-3]] +
                      "                  ")
            break
        else:
            s = input("是否显示出线小组详细信息 (Y or N,输入N开始下一场比赛) : ")
    print(
        """==================================F19 8进4================================="""
    )
    ####F19 8 4####
    s = input("Please input 2 to start match F19 8 4 : ")
    while s != "2":
        if s == "Break":
            sys.exit(0)
        s = input("Please input 2 first to start match F19 8 4 : ")

    allplayerlist2 = []
    seed = [0, 1, 2, 3]
    shuffle(seed)
    players = [players[i] for i in seed]
    for i in range(4):
        everypair = []
        everypair.append(players[i])
        everypair.append(nextstage1[i])
        allplayerlist2.append(everypair)
    nextstage2 = []
    path = mkdir('F19 8 4')
    pool = Pool()
    nextstage2 = pool.map(
        newmain,
        [(allplayerlist2[i],
          path + "/" + inf.information[allplayerlist2[i][0][11:-3]] + " " +
          "vs" + " " + inf.information[allplayerlist2[i][1][11:-3]], livequeue,
          True, True, True, False, c.REPEAT, c.MAXTIME, c.ROUNDS)
         for i in range(len(allplayerlist2))])
    pool.close()
    pool.join()
    #print(nextstage2)
    f = open(path + '/' + "winners F19 8 4.txt", 'w')
    f.write("F19 8 4 winners:" + "\n")
    for i in range(len(nextstage2)):
        f.write(inf.information[nextstage2[i][11:-3]] + "\n")
    f.close()
    s = input("是否显示出线小组详细信息 (Y or N) : ")
    f = Figlet()
    print(
        """==========================================================================="""
    )
    print(f.renderText("Congratulations"))
    print(
        """================================F19 8进4结果==============================="""
    )
    while s != "N":
        if s == "Y":
            print(
                "                       恭喜以下小组同学出线!                                   "
            )
            for i in range(len(nextstage2)):
                print("                         " +
                      inf.information[nextstage2[i][11:-3]] +
                      "                ")
            break
        else:
            s = input("是否显示出线小组详细信息 (Y or N,输入N开始下一场比赛) : ")
    print(
        """=================================F19 4进2================================="""
    )
    ####F19 4 2 ####
    s = input("Please input 3 to start match F19 4 2 : ")
    while s != "3":
        if s == "Break":
            sys.exit(0)
        s = input("Please input 3 to start match F19 4 2 : ")

    allplayerlist3 = []
    a = random.randint(0, 1)
    b = random.randint(2, 3)
    players1 = [nextstage2[a], nextstage2[b]]
    players2 = [nextstage2[1 - a], nextstage2[5 - b]]
    for i in range(2):
        everypair = []
        everypair.append(players1[i])
        everypair.append(players2[i])
        allplayerlist3.append(everypair)
    nextstage3 = []
    path = mkdir('F19 4 2')
    pool = Pool()
    nextstage3 = pool.map(
        newmain,
        [(allplayerlist3[i],
          path + "/" + inf.information[allplayerlist3[i][0][11:-3]] + " " +
          "vs" + " " + inf.information[allplayerlist3[i][1][11:-3]], livequeue,
          True, True, True, False, c.REPEAT, c.MAXTIME, c.ROUNDS)
         for i in range(len(allplayerlist3))])
    pool.close()
    pool.join()
    #print(nextstage3)
    f = open(path + '/' + "winners F19 4 2.txt", 'w')
    f.write("F19 4 2 winners:" + "\n")
    for i in range(len(nextstage3)):
        f.write(inf.information[nextstage3[i][11:-3]] + "\n")
    f.close()
    s = input("是否显示出线小组详细信息 (Y or N) :")
    print(
        """======================================================================="""
    )
    f = Figlet()
    print(f.renderText("Congratulations"))
    print(
        """================================F19 4进2结果==========================="""
    )
    while s != "N":
        if s == "Y":
            print(
                "                           恭喜以下小组同学出线!                               "
            )
            for i in range(len(nextstage3)):
                print("                          " +
                      inf.information[nextstage3[i][11:-3]] +
                      "                ")
            break
        else:
            s = input("是否显示出线小组详细信息 (Y or N,输入N开始下一场比赛) : ")
    print(
        """=============================F19 决赛=================================="""
    )
    ####记录季军####
    allthirds = []
    for i in range(len(nextstage2)):
        if nextstage2[i] not in nextstage3:
            allthirds.append(inf.information[nextstage2[i][11:-3]])
    ####F19 final####
    s = input("Please input 4 to start match F19 final : ")
    while s != "4":
        if s == "Break":
            sys.exit(0)
        s = input("Please input 4 to start match F19 final : ")
    path = mkdir('F19 final')
    winnerF19 = runner.main(
        nextstage3, path + "/" + inf.information[nextstage3[0][11:-3]] + " " +
        "vs" + " " + inf.information[nextstage3[1][11:-3]], finallivequeue,
        True, True, True, False, c.REPEAT, c.MAXTIME, c.ROUNDS)[3]
    F19 = winnerF19
    #print(winnerF19)
    f = open(path + '/' + "winners F19 final.txt", 'w')
    f.write("F19 final winners:" + "\n")
    f.write(inf.information[winnerF19[11:-3]])
    f.close()
    s = input("是否显示出线小组详细信息 (Y or N) : ")
    print(
        """======================================================================="""
    )
    f = Figlet()
    print(f.renderText("Congratulations   "))
    print(
        """=============================F19 决赛结果=============================="""
    )
    while s != "N":
        if s == "Y":
            print(
                "                        恭喜以下小组为F19组冠军!                               "
            )
            print("                             " +
                  inf.information[winnerF19[11:-3]] + "                      ")
            break
        else:
            s = input("是否显示F19冠军小组详细信息 (Y or N,输入N结束F19组比赛) : ")
    print(
        """======================================================================="""
    )
    ###记录亚军###
    second = []
    for i in range(len(nextstage3)):
        if nextstage3[i] != winnerF19:
            second.append(inf.information[nextstage3[i][11:-3]])
    return [F19, second, allthirds]
Exemplo n.º 2
0
def N19(livequeue=None, finallivequeue=None):
    def mkdir(path):
        folder = os.path.exists(path)
        if folder == False:
            os.makedirs(path)
        else:
            path = path + "_" + "1"
            while os.path.exists(path) == True:
                path = path[0:-1] + str(int(path[-1]) + 1)
            os.makedirs(path)
        return path

    fileList = os.listdir("F19players")
    if fileList[-1] == "__pycache__":
        fileList.pop()
    #####################
    print(
        """==============================N19 比赛==================================="""
    )
    f = Figlet()
    print(f.renderText("             2 0 4 8     N19"))
    print(
        """===================================N19 第一场============================"""
    )
    ####N19 比赛####
    fileList = os.listdir("N19players")
    if "__pycache__" in fileList:
        fileList.remove("__pycache__")
    ####N19 8 4####
    s = input("Please input 1 to start match N19 8 4 : ")
    while s != "1":
        if s == "Break":
            sys.exit(0)
        s = input("Please input 1  to start match N19 8 4 : ")
    players1 = []
    players2 = []
    for i in range(len(fileList)):
        if int(fileList[i][6]) > 4 and int(fileList[i][6]) < 9:
            players2.append("N19players" + "/" + fileList[i])
        else:
            players1.append("N19players" + "/" + fileList[i])
    seed = [0, 1, 2, 3]
    shuffle(seed)
    players1 = [players1[i] for i in seed]
    allplayerlistN1 = []
    for i in range(4):
        everypair = []
        everypair.append(players1[i])
        everypair.append(players2[i])
        allplayerlistN1.append(everypair)
    nextstageN1 = []
    path = mkdir('N19 8 4')
    pool = Pool()
    nextstageN1 = pool.map(
        newmain,
        [(allplayerlistN1[i],
          path + "/" + inf.information[allplayerlistN1[i][0][11:-3]] + " " +
          "vs" + " " + inf.information[allplayerlistN1[i][1][11:-3]],
          livequeue, True, True, True, False, c.REPEAT, c.MAXTIME, c.ROUNDS)
         for i in range(len(allplayerlistN1))])
    pool.close()
    pool.join()
    #print(nextstageN1)
    f = open(path + "/" + "winners N19 8 4 .txt", 'w')
    f.write("N19 8 4 winners:" + "\n")
    for i in range(len(nextstageN1)):
        f.write(inf.information[nextstageN1[i][11:-3]] + "\n")
    f.close()
    s = input("是否显示出线小组详细信息 (Y or N) : ")
    f = Figlet()
    print(
        """============================================================================"""
    )
    print(f.renderText("Congratulations"))
    print(
        """================================N19 第一场结果==============================="""
    )

    while s != "N":
        if s == "Y":
            print(
                "                           恭喜以下小组同学出线!                               "
            )
            for i in range(len(nextstageN1)):
                print("              " +
                      inf.information[nextstageN1[i][11:-3]] +
                      "                  ")
            break
        else:
            s = input("是否显示出线小组详细信息 (Y or N,输入N开始下一场比赛) : ")
    print(
        """=============================N19 4进2======================================="""
    )
    ####N19 4 2 ####
    s = input("Please input 2 to start match N19 4 2 : ")
    while s != "2":
        if s == "Break":
            sys.exit(0)
        s = input("Please input 2 first to start match N19 4 2 : ")

    allplayerlistN2 = []
    a = random.randint(0, 1)
    if a == 0:
        players1 = [nextstageN1[0], nextstageN1[1]]
        players2 = [nextstageN1[2], nextstageN1[3]]
    else:
        players1 = [nextstageN1[0], nextstageN1[1]]
        players2 = [nextstageN1[3], nextstageN1[2]]
    for i in range(2):
        everypair = []
        everypair.append(players1[i])
        everypair.append(players2[i])
        allplayerlistN2.append(everypair)
    nextstageN3 = []
    path = mkdir('N19 4 2')
    pool = Pool()
    nextstageN3 = pool.map(
        newmain,
        [(allplayerlistN2[i],
          path + "/" + inf.information[allplayerlistN2[i][0][11:-3]] + " " +
          "vs" + " " + inf.information[allplayerlistN2[i][1][11:-3]],
          livequeue, True, True, True, False, c.REPEAT, c.MAXTIME, c.ROUNDS)
         for i in range(len(allplayerlistN2))])
    pool.close()
    pool.join()
    #print(nextstageN3)
    third = []
    for i in range(len(nextstageN1)):
        if nextstageN1[i] not in nextstageN3:
            third.append(nextstageN1[i])
    f = open(path + '/' + "winners N19 4 2.txt", 'w')
    f.write("N19 4 2 winners:" + "\n")
    for i in range(len(nextstageN3)):
        f.write(inf.information[nextstageN3[i][11:-3]] + "\n")
    f.close()
    s = input("是否显示出线小组详细信息 (Y or N) : ")
    f = Figlet()
    print(
        """=========================================================================="""
    )
    print(f.renderText("Congratulations"))
    print(
        """================================N19 4进2结果==============================="""
    )
    while s != "N":
        if s == "Y":
            print(
                "                         恭喜以下小组同学出线!                               "
            )
            for i in range(len(nextstageN3)):
                print("                 " +
                      inf.information[nextstageN3[i][11:-3]] + "             ")
            break
        else:
            s = input("是否显示出线小组详细信息 (Y or N,输入N开始下一场比赛) : ")
    print(
        """================================N19 季军================================="""
    )
    ###N19季军###
    s = input("Please input 3 to start match N19 third : ")
    while s != "3":
        if s == "Break":
            sys.exit(0)
        s = input("Please input 3 to start match N19 third : ")
    path = mkdir('N19 third')
    third = runner.main(third,
                        savepath=path + "/" +
                        inf.information[third[0][11:-3]] + " " + "vs" + " " +
                        inf.information[third[1][11:-3]],
                        toGet=True)[3]
    #print(third)
    f = open(path + '/' + "third N19 final.txt", 'w')
    f.write("N19 third:" + "\n")
    f.write(inf.information[third[11:-3]])
    f.close()
    s = input("是否显示出线小组详细信息 (Y or N) : ")
    f = Figlet()
    print(
        """=========================================================================="""
    )
    print(f.renderText("Congratulations"))
    print(
        """================================N19 季军结果==============================="""
    )
    while s != "N":
        if s == "Y":
            print(
                "                      恭喜以下小组同学获得N19组季军!                           "
            )
            print("                      " + inf.information[third[11:-3]] +
                  "                       ")
            break
        else:
            s = input("是否显示N19组季军小组详细信息 (Y or N,输入N开始下一场比赛) : ")
    print(
        """===============================N19 决赛==================================="""
    )
    ####N19 final####
    s = input("Please input 4 to start match N19 final : ")
    while s != "4":
        if s == "Break":
            sys.exit(0)
        s = input("Please input 4 to start match N19 final : ")
    path = mkdir('N19 final')
    winnerN19 = runner.main(
        nextstageN3, path + "/" + inf.information[nextstageN3[0][11:-3]] +
        " " + "vs" + " " + inf.information[nextstageN3[1][11:-3]],
        finallivequeue, True, True, True, False, c.REPEAT, c.MAXTIME,
        c.ROUNDS)[3]
    N19 = winnerN19
    #print(winnerN19)
    f = open(path + '/' + "winners N19 final.txt", 'w')
    f.write("N19 final winners:" + "\n")
    f.write(inf.information[winnerN19[11:-3]])
    f.close()
    second = []
    for i in range(len(nextstageN3)):
        if nextstageN3[i] != winnerN19:
            second.append(nextstageN3[i])
    s = input("是否显示出线小组详细信息 (Y or N) : ")
    f = Figlet()
    print(
        """========================================================================="""
    )
    print(f.renderText("Congratulations"))
    print(
        """================================N19 决赛结果=============================="""
    )
    while s != "N":
        if s == "Y":
            print(
                "                       恭喜以下小组同学获得N19组冠军!                         "
            )
            print("                          " +
                  inf.information[winnerN19[11:-3]] + "                      ")
            break
        else:
            s = input("是否显示N19组冠军小组详细信息 (Y or N,输入N结束当N19组比赛) : ")
    print(
        """=========================================================================="""
    )
    return [
        N19, inf.information[second[0][11:-3]], inf.information[third[11:-3]]
    ]
Exemplo n.º 3
0
def newmain(args):
    return runner.main(*args)[3]
Exemplo n.º 4
0
def friendship(livequeue=None):
    def mkdir(path):
        folder = os.path.exists(path)
        if folder == False:
            os.makedirs(path)
        else:
            path = path + "_" + "1"
            while os.path.exists(path) == True:
                path = path[0:-1] + str(int(path[-1]) + 1)
            os.makedirs(path)
        return path

    print(
        """=============================友谊赛================================""")
    f = Figlet()
    print(f.renderText("        2 0 4 8    Final"))
    ####Friendship####
    print(
        """================================================================""")
    s = input("Please input F to start match all final : ")
    while s != "F":
        if s == "Break":
            sys.exit(0)
        s = input("Please input F to start match all final : ")
    finalplayerlist = [NwinnerN19, FwinnerF19]
    path = mkdir('all final')
    winnerfinal = runner.main(
        finalplayerlist,
        path + "/" + " " + inf.information[NwinnerN19[11:-3]] + " " + "vs" +
        " " + inf.information[FwinnerF19[11:-3]], live.queues[2], True, True,
        True, False, c.REPEAT, c.MAXTIME, c.ROUNDS)[3]
    #print(winnerfinal)
    f = open(path + '/' + "all final.txt", 'w')
    f.write("all final winners:" + "\n")
    f.write(inf.information[winnerfinal[11:-3]])
    f.close()
    s = input("是否显示出线小组详细信息 (Y or N) : ")
    f = Figlet()
    print(
        """================================================================""")
    print(f.renderText("Congratulations"))
    print("""=========================N19 友谊赛结果===========================""")
    while s != "N":
        if s == "Y":
            print(
                "               恭喜以下小组同学获得本次对抗2048比赛总冠军!                    ")
            print("                                      " +
                  inf.information[winnerfinal[11:-3]] +
                  "                     ")
            break
        else:
            s = input("是否显示总冠军小组详细信息 (Y or N,输入N进入颁奖) : ")
    print(
        """=================================================================="""
    )
    ###比赛冠亚季军汇报###
    s = input("是否输入命令汇报比赛冠亚季军结果 (Y or N) : ")
    print(
        """=============================颁奖汇报==============================""")
    while s != "N":
        if s == "Y":
            f = Figlet()
            print(
                """=================================================================="""
            )
            print(f.renderText("Congratulations"))
            print(
                """===============================F19组冠亚季军==========================="""
            )
            print("               恭喜以下小组同学获得本次对抗2048比赛冠亚季军!                  ")
            print(
                "                              F19组季军:                                  "
            )
            print("                               " + thirdsF191 +
                  "                                 ")
            print("                              " + thirdsF192)
            print(
                "                              F19组亚军:                                  "
            )
            print("                              " + secondF19)
            print(
                "                              F19组冠军:                                  "
            )
            print("                                " +
                  inf.information[FwinnerF19[11:-3]])
            print(
                """===========================N19组冠亚季军============================"""
            )
            print(
                "                              N19组季军:                                      "
            )
            print("                               " + thirdN19)
            print(
                "                              N19组亚军:                                      "
            )
            print("                               " + secondN19)
            print(
                "                              N19组冠军:                                       "
            )
            print("                               " +
                  inf.information[NwinnerN19[11:-3]])
            print(
                """=============================友谊赛总冠军============================="""
            )
            print(
                "                            友谊赛总冠军:                                 "
            )
            print("                                " +
                  inf.information[winnerfinal[11:-3]])
            print(
                """====================================================================="""
            )
            f = Figlet()
            print(
                f.renderText("                          2048               "))
            print(
                """======================================================================"""
            )
            break
        else:
            s = input("是否输入 Report 命令开始汇报比赛冠亚季军结果 (Y or N,输入N结束比赛) : ")
    f = Figlet()
    print(f.renderText("                              END            "))
    print(
        """=============================================================================="""
    )