本文整理汇总了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