def sim_game(homeo, homed, awayo, awayd, HFAmult):
import random
from itertools import accumulate
import bisect
from math import fsum
homeodds,awayodds = single_match_odds(homeo, homed, awayo, awayd, HFAmult)
hometotalodds = list(accumulate(homeodds))
awaytotalodds = list(accumulate(awayodds))
homerand = random.uniform(0,hometotalodds[-1])
awayrand = random.uniform(0,awaytotalodds[-1])
home_goals = bisect.bisect(hometotalodds, homerand)
away_goals = bisect.bisect(awaytotalodds, awayrand)
return home_goals, away_goals
## @brief Class representing a single soccer match-up.
# @details Includes team names and home field multiplier (default 1, set to 0
# if neutral-field). Also holds score, and simulates the game to get it if need
# be.
# @since FutbolRatings 0.4.0, 2016.06.13
评论列表
文章目录