当前位置: 首页>>代码示例>>Python>>正文


Python Path.create_with_single_territory方法代码示例

本文整理汇总了Python中Path.Path.create_with_single_territory方法的典型用法代码示例。如果您正苦于以下问题:Python Path.create_with_single_territory方法的具体用法?Python Path.create_with_single_territory怎么用?Python Path.create_with_single_territory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Path.Path的用法示例。


在下文中一共展示了Path.create_with_single_territory方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_paths_accessible_by_player

# 需要导入模块: from Path import Path [as 别名]
# 或者: from Path.Path import create_with_single_territory [as 别名]
    def get_paths_accessible_by_player(self, player, max_length=9999):
        paths = []
        seen_territory_ids = set()

        partial_paths = deque()
        for territory in player.territories:
            partial_paths.append(Path.create_with_single_territory(territory))
        while len(partial_paths) > 0:
            path = partial_paths.popleft()

            # prune paths that have less than 5% chance of being conquered
            if path.probability_of_conquering_path < 0.03:
                continue

            paths.append(path)
            for territory in path[-1].adjacent_territories:
                if territory.player != player and territory not in path:
                    partial_paths.append(Path.create_by_appending_path_with_territory(path, territory))

        return paths
开发者ID:arjun1985,项目名称:brisk,代码行数:22,代码来源:BriskMap.py


注:本文中的Path.Path.create_with_single_territory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。