From 2c14d7cf7382f0c0865c2c0b495d7a13550622ac Mon Sep 17 00:00:00 2001 From: Sakimori Date: Sun, 3 Jan 2021 06:56:40 -0500 Subject: [PATCH] added win values to debug tourney to test win seeding --- leagues.py | 7 +++++-- the_prestige.py | 26 +++++++++++++------------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/leagues.py b/leagues.py index 6c59a42..8291c20 100644 --- a/leagues.py +++ b/leagues.py @@ -1,5 +1,6 @@ import time, asyncio, jsonpickle, random, math from games import team, game +from discord import Embed, Color import database as db @@ -37,7 +38,7 @@ class tournament(object): elif by_wins: def sorter(team_in_list): - return self.teams[team_in_list][0] #sorts by wins + return self.teams[team_in_list]["wins"] #sorts by wins else: #sort by average stars def sorter(team_in_list): @@ -50,9 +51,10 @@ class tournament(object): for i in range(0, empty_slots): teams_list.append(None) + print(teams_list) previous_bracket_layer = teams_list.copy() - for i in range(0, bracket_layers-1): + for i in range(0, bracket_layers - 1): this_layer = [] for pair in range(0, int(len(previous_bracket_layer)/2)): if pair % 2 == 0: #if even number @@ -60,6 +62,7 @@ class tournament(object): else: this_layer.insert(0-int((1+pair)/2), [previous_bracket_layer.pop(0), previous_bracket_layer.pop(-1)]) #every other pair goes at end of list, moving backward previous_bracket_layer = this_layer + print(previous_bracket_layer) self.bracket = bracket(previous_bracket_layer, bracket_layers) self.bracket.get_bottom_row() diff --git a/the_prestige.py b/the_prestige.py index f426b90..8ab698d 100644 --- a/the_prestige.py +++ b/the_prestige.py @@ -436,20 +436,20 @@ class StartTournamentCommand(Command): async def execute(self, msg, command): test_bracket = { - games.get_team("Milwaukee Lockpicks") : {"wins": 0, "rd": 0}, - games.get_team("Madagascar Penguins") : {"wins": 0, "rd": 0}, - games.get_team("Twin Cities Evening") : {"wins": 0, "rd": 0}, - games.get_team("Washington State Houses") : {"wins": 0, "rd": 0}, - games.get_team("Appalachian Underground") : {"wins": 0, "rd": 0}, - games.get_team("Pacific2 Rams") : {"wins": 0, "rd": 0}, - games.get_team("New Jersey Radio") : {"wins": 0, "rd": 0}, - games.get_team("Moline Jolenes") : {"wins": 0, "rd": 0}, - games.get_team("California Commissioners") : {"wins": 0, "rd": 0}, - games.get_team("Pigeon’s Reckoning") : {"wins": 0, "rd": 0}, - games.get_team("Kernow Technologists") : {"wins": 0, "rd": 0} + games.get_team("Milwaukee Lockpicks") : {"wins": 10, "rd": 0}, + games.get_team("Madagascar Penguins") : {"wins": 2, "rd": 0}, + games.get_team("Twin Cities Evening") : {"wins": 1, "rd": 0}, + games.get_team("Washington State Houses") : {"wins": 9, "rd": 0}, + games.get_team("Appalachian Underground") : {"wins": 8, "rd": 0}, + games.get_team("Pacific2 Rams") : {"wins": 3, "rd": 0}, + games.get_team("New Jersey Radio") : {"wins": 45, "rd": 0}, + games.get_team("Moline Jolenes") : {"wins": 44, "rd": 0}, + games.get_team("California Commissioners") : {"wins": 41, "rd": 0}, + games.get_team("Pigeon’s Reckoning") : {"wins": 45, "rd": 0}, + games.get_team("Kernow Technologists") : {"wins": 42, "rd": 0} } tourney = leagues.tournament("Test Tourney", test_bracket, max_innings=3) - tourney.build_bracket(random_sort=True) + tourney.build_bracket(by_wins=True) await start_tournament_round(msg.channel, tourney) @@ -757,7 +757,7 @@ async def start_tournament_round(channel, tourney, seeding = None): ext = "?league=" + urllib.parse.quote_plus(tourney.name) await channel.send(f"{len(current_games)} games started for the {tourney.name} tournament, at {config()['simmadome_url']+ext}") - await tourney_watcher(channel, tourney, current_games)) + await tourney_watcher(channel, tourney, current_games) async def tourney_watcher(channel, tourney, games_list):