Example #1
0
    def next_rounds(self, tournament):
        """
        :param tournament:
        :return:
        """
        roundnumber = len(tournament.tournees) + 1
        fstring = f"Round{roundnumber}"
        sortedscorelist = tournament.sort_by_score()
        nexttour = []
        for ii in range(0, len(sortedscorelist), 2):
            nexttour.append((sortedscorelist[ii], sortedscorelist[ii + 1]))
        nextround = classes.Round(fstring, nexttour)
        tournament.tournees.append(nextround)

        # insertion du round et du match sans resultat dans la DB
        indexr = roundnumber - 1
        self.tournamentDb.insert_round(tournament, indexr)
        indexm = 0
        for match in nextround.matches:
            p1 = match[0][0]
            p2 = match[1][0]
            self.tournamentDb.init_match(tournament, indexr, indexm, p1, p2)
            indexm += 1

        # Préparation du match
        print(indexr, indexm)
        self.view.show_elo_match(nextround.matches)
        results = self.view.enter_results(nextround.matches)
        self.process_results(tournament, results)
Example #2
0
    def first_round(self, tournament):
        """
        :param tournament:
        :return:
        """
        middle = len(tournament.players) // 2
        lowerhalf = tournament.players[:middle]
        upperhalf = tournament.players[middle:]
        tour1 = []
        for ii in range(0, middle):
            tour1.append(([lowerhalf[ii], 0], [upperhalf[ii], 0]))
        round1 = classes.Round('Round1', tour1)
        tournament.tournees.append(round1)

        # insertion du round 1 et du match 1 sans resultat dans la DB
        self.tournamentDb.insert_round(tournament, 0)
        indexm = 0
        for match in round1.matches:
            p1 = match[0][0]
            p2 = match[1][0]
            self.tournamentDb.init_match(tournament, 0, indexm, p1, p2)
            indexm += 1

        # Préparation du match
        self.view.show_elo_match(round1.matches)
        results = self.view.enter_results(round1.matches)
        self.process_results(tournament, results)
def load_into_round_class():
    order_requests=[]
    for i,name,drink in zip(load_csv_owner(),load_csv_name(),load_csv_drink()):
        R1=classes.Round(i)
        R1.add_order(name,drink)
        order_requests.append(R1)
    return order_requests
Example #4
0
def load_into_round_class():
    order_requests = []
    for i, name, drink in zip(load_into_list(round_file, 'owner'),
                              load_into_list(round_file, 'name'),
                              load_into_list(round_file, 'drink')):
        R1 = classes.Round(i)
        R1.add_order(name, drink)
        order_requests.append(R1)
    return order_requests
Example #5
0
def round_of_drinks():
    print(print_people)
    try:
        input_round = input(str('who will be buying the round of drinks?\n'))
    except ValueError:
        print('enter a word please not an integer')
    round1 = classes.Round(input_round)
    try:
        input_name = input(
            str('name of people you are buying for seprated by spaces?\n'))
    except ValueError:
        print('enter a word please not an integer')
    input_list_name = input_name.split()
    print(drinks)
    try:
        input_drink = input(
            str('enter the corresponding drinks that the people would like to order\n'
                ))
    except ValueError:
        print('please enter a word please not an integer')
    input_list_drink = input_drink.split()
    for name, drink in zip(input_list_name, input_list_drink):
        round1.add_order(name, drink)