本文整理汇总了Python中pelita.graph.AdjacencyList.values方法的典型用法代码示例。如果您正苦于以下问题:Python AdjacencyList.values方法的具体用法?Python AdjacencyList.values怎么用?Python AdjacencyList.values使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pelita.graph.AdjacencyList
的用法示例。
在下文中一共展示了AdjacencyList.values方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_extended_adjacency_list
# 需要导入模块: from pelita.graph import AdjacencyList [as 别名]
# 或者: from pelita.graph.AdjacencyList import values [as 别名]
def test_extended_adjacency_list(self):
test_layout = (
""" ##################
#0#. . # . #
# ##### ##### #
# . # . .#1#
################## """)
universe = CTFUniverse.create(test_layout, 2)
al = AdjacencyList(universe.free_positions())
adjacency_target = {(7, 3): [(7, 2), (7, 3), (6, 3)],
(1, 3): [(1, 2), (2, 3), (1, 3)],
(12, 1): [(13, 1), (12, 1), (11, 1)],
(16, 2): [(16, 3), (16, 1), (16, 2)],
(15, 1): [(16, 1), (15, 1), (14, 1)],
(5, 1): [(6, 1), (5, 1), (4, 1)],
(10, 3): [(10, 2), (11, 3), (10, 3), (9, 3)],
(7, 2): [(7, 3), (7, 1), (8, 2), (7, 2)],
(1, 2): [(1, 3), (1, 1), (1, 2)],
(3, 3): [(4, 3), (3, 3), (2, 3)],
(13, 3): [(14, 3), (13, 3), (12, 3)],
(8, 1): [(8, 2), (8, 1), (7, 1)],
(16, 3): [(16, 2), (16, 3)],
(6, 3): [(7, 3), (6, 3), (5, 3)],
(14, 1): [(15, 1), (14, 1), (13, 1)],
(11, 1): [(12, 1), (11, 1), (10, 1)],
(4, 1): [(5, 1), (4, 1), (3, 1)],
(1, 1): [(1, 2), (1, 1)],
(12, 3): [(13, 3), (12, 3), (11, 3)],
(8, 2): [(8, 1), (9, 2), (8, 2), (7, 2)],
(7, 1): [(7, 2), (8, 1), (7, 1), (6, 1)],
(9, 3): [(9, 2), (10, 3), (9, 3)],
(2, 3): [(3, 3), (2, 3), (1, 3)],
(10, 1): [(10, 2), (11, 1), (10, 1)],
(5, 3): [(6, 3), (5, 3), (4, 3)],
(13, 1): [(14, 1), (13, 1), (12, 1)],
(9, 2): [(9, 3), (10, 2), (9, 2), (8, 2)],
(6, 1): [(7, 1), (6, 1), (5, 1)],
(3, 1): [(4, 1), (3, 1)],
(11, 3): [(12, 3), (11, 3), (10, 3)],
(16, 1): [(16, 2), (16, 1), (15, 1)],
(4, 3): [(5, 3), (4, 3), (3, 3)],
(14, 3): [(14, 3), (13, 3)],
(10, 2): [(10, 3), (10, 1), (10, 2), (9, 2)]}
for val in al.values():
val.sort()
for val in adjacency_target.values():
val.sort()
assert adjacency_target == al
示例2: test_basic_adjacency_list
# 需要导入模块: from pelita.graph import AdjacencyList [as 别名]
# 或者: from pelita.graph.AdjacencyList import values [as 别名]
def test_basic_adjacency_list(self):
test_layout = (
""" ######
# #
###### """)
universe = CTFUniverse.create(test_layout, 0)
al = AdjacencyList(universe.free_positions())
target = { (4, 1): [(4, 1), (3, 1)],
(1, 1): [(2, 1), (1, 1)],
(2, 1): [(3, 1), (2, 1), (1, 1)],
(3, 1): [(4, 1), (3, 1), (2, 1)]}
for val in al.values():
val.sort()
for val in target.values():
val.sort()
assert target == al