play_utils.py 文件源码

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

项目:SICPinPython 作者: kimochg 项目源码 文件源码
def make_random_strat():
    """Makes a random pure strategy."""
    seed = random.randrange(0, 2 ** 31)

    def random_strat(score, opponent_score):
        # Save the state of the random generator, so strategy calls don't
        # impact dice rolls.
        state = random.getstate()
        random.seed(hash((score, opponent_score, seed)))
        roll = random.randrange(0, 11)
        random.setstate(state)
        return roll
    return random_strat
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号