groups.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:FutbolRatings 作者: PsyMar 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号