added handling for postseason constraints

This commit is contained in:
Sakimori 2021-01-14 17:47:57 -05:00
parent ee55b00caf
commit 6b56c87bef
4 changed files with 7 additions and 2 deletions

View File

@ -81,6 +81,7 @@ def save_league(league):
state_dic = { state_dic = {
"season" : league.season, "season" : league.season,
"day" : league.day, "day" : league.day,
"constraints" : league.constraints,
"schedule" : league.schedule, "schedule" : league.schedule,
"game_length" : league.game_length, "game_length" : league.game_length,
"series_length" : league.series_length, "series_length" : league.series_length,

View File

@ -19,7 +19,9 @@ class league_structure(object):
self.constraints = { self.constraints = {
"division_games" : division_games, "division_games" : division_games,
"inter_div_games" : inter_division_games, "inter_div_games" : inter_division_games,
"inter_league_games" : inter_league_games "inter_league_games" : inter_league_games,
"division_leaders" : 0,
"wild_cards" : 0
} }
self.day = 1 self.day = 1
self.schedule = {} self.schedule = {}

View File

@ -62,6 +62,8 @@ def create_league():
inter_division_games=config['inter_division_series'], inter_division_games=config['inter_division_series'],
inter_league_games=config['inter_league_series'], inter_league_games=config['inter_league_series'],
) )
new_league.constraints["division_leaders"] = config["top_postseason"]
new_league.constraints["wild_cards"] = config["wildcards"]
new_league.generate_schedule() new_league.generate_schedule()
leagues.save_league(new_league) leagues.save_league(new_league)

View File

@ -6,4 +6,4 @@ SELECT name,
ROUND(strikeouts_given*27.0/(outs_pitched*1.0),3) as kper9, ROUND(strikeouts_given*27.0/(outs_pitched*1.0),3) as kper9,
ROUND(strikeouts_given*1.0/walks_allowed*1.0,3) as kperbb ROUND(strikeouts_given*1.0/walks_allowed*1.0,3) as kperbb
FROM stats WHERE outs_pitched > 150 FROM stats WHERE outs_pitched > 150
ORDER BY bbper9 ASC; ORDER BY era ASC;