本文整理汇总了Python中maze.Maze.pretty_print方法的典型用法代码示例。如果您正苦于以下问题:Python Maze.pretty_print方法的具体用法?Python Maze.pretty_print怎么用?Python Maze.pretty_print使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类maze.Maze
的用法示例。
在下文中一共展示了Maze.pretty_print方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Rule
# 需要导入模块: from maze import Maze [as 别名]
# 或者: from maze.Maze import pretty_print [as 别名]
rule2 = Rule(c3, [(50, maze1), (50, maze2)])
with self.assertRaises(ValueError):
Grammar([rule1, rule2])
rules = []
try:
for wall_number in range(5):
for combination in combinations(Directions, wall_number):
rules.append(Rule(Cell(combination), [(100, maze3)]))
grammar = Grammar(rules)
except ValueError:
self.fail("This grammar should be valid but raised an exception")
if __name__ == '__main__':
c1 = Cell({Directions.N})
c2 = Cell({Directions.S})
c3 = Cell({Directions.N, Directions.E})
c4 = Cell({})
maze3 = Maze(2, 1, {(0, 0): c2, (1, 0): c3})
rules = []
for wall_number in range(5):
for combination in combinations(Directions, wall_number):
rules.append(Rule(Cell(combination), [(100, maze3)]))
grammar = Grammar(rules)
print(grammar)
maze3.pretty_print()
maze4 = grammar.iterate(maze3)
maze4.pretty_print()
# unittest.main()