added win values to debug tourney to test win seeding

This commit is contained in:
Sakimori 2021-01-03 06:56:40 -05:00
parent 527170a81e
commit 2c14d7cf73
2 changed files with 18 additions and 15 deletions

View File

@ -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()

View File

@ -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("Pigeons 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("Pigeons 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):