From 28dca13f536c286032f2a5a445e840ebe53eb159 Mon Sep 17 00:00:00 2001 From: Sakimori Date: Sun, 3 Jan 2021 03:51:45 -0500 Subject: [PATCH] moved league work to new branch in case not ready for monday release --- leagues.py | 48 --------------------------------------------- main_controller.py | 2 +- the-prestige.pyproj | 3 --- the_prestige.py | 2 +- 4 files changed, 2 insertions(+), 53 deletions(-) delete mode 100644 leagues.py diff --git a/leagues.py b/leagues.py deleted file mode 100644 index ad18681..0000000 --- a/leagues.py +++ /dev/null @@ -1,48 +0,0 @@ -import time, asyncio, jsonpickle, random, math -from games import team, game -import database as db - - - - - -class league(object): - def __init__(self, name, subleagues_dic): - self.subleagues = {} #key: name, value: [divisions] - self.max_days - self.day = 1 - self.name = name - self.subleagues = subleagues_dic - -class division(object): - def __init__(self): - self.teams = {} #key: team object, value: {wins; losses; run diff} - -class tournament(object): - def __init__(self, team_dic): - self.teams = {} #same format as division, wins/losses will be used for seeding later - self.bracket = {} - self.bracket_layers = 0 - - def build_bracket(self, random = False, by_wins = False): - teams_list = self.teams.keys().copy() - - if random: - def sorter(team_in_list): - return random.random() - - elif by_wins: - def sorter(team_in_list): - return self.teams[team_in_list][0] #sorts by wins - - if not random and not by_wins: #sort by average stars - def sorter(team_in_list): - return team_in_list.average_stars() - - teams_list.sort(key=sorter, reverse=True) - - self.bracket_layers = int(math.ceil(math.log(len(teams_list), 2))) - empty_slots = int(math.pow(2, bracket_layers) - len(teams_list)) - - for i in range(0, empty_slots): - teams_list.append(None) diff --git a/main_controller.py b/main_controller.py index 65892a4..d6ae7ff 100644 --- a/main_controller.py +++ b/main_controller.py @@ -1,4 +1,4 @@ -import asyncio, time, datetime, games, json, threading, jinja2, leagues +import asyncio, time, datetime, games, json, threading, jinja2 from flask import Flask, url_for, Response, render_template, request, jsonify from flask_socketio import SocketIO, emit diff --git a/the-prestige.pyproj b/the-prestige.pyproj index 351afa6..c9f6968 100644 --- a/the-prestige.pyproj +++ b/the-prestige.pyproj @@ -29,9 +29,6 @@ Code - - Code - Code diff --git a/the_prestige.py b/the_prestige.py index badfa81..87dafab 100644 --- a/the_prestige.py +++ b/the_prestige.py @@ -1,4 +1,4 @@ -import discord, json, math, os, roman, games, asyncio, random, main_controller, threading, time, leagues, urllib +import discord, json, math, os, roman, games, asyncio, random, main_controller, threading, time, urllib import database as db import onomancer as ono from flask import Flask