connect4_play.py 文件源码

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

项目:mittmcts 作者: dbravender 项目源码 文件源码
def dump_state(state, children=None, move=None):
    if children is None:
        children = []

    if state.current_player == 0:
        overall_percent = (sum(child.wins_by_player[0]
                               for child in children) / 1000.0) * 100
    else:
        overall_percent = None

    children = {
        child.move: {'ucb': child.ucb1(child.parent.current_player),
                     'visits': child.visits,
                     'wins': child.wins_by_player[child.parent.current_player]}
        for child in children}

    print(dumps({'state': state.__dict__,
                 'children': children,
                 'overall_percent': overall_percent,
                 'error': None},
                cls=GameEncoder))
    stdout.flush()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号