本文整理汇总了Python中maze.Maze.finish方法的典型用法代码示例。如果您正苦于以下问题:Python Maze.finish方法的具体用法?Python Maze.finish怎么用?Python Maze.finish使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类maze.Maze
的用法示例。
在下文中一共展示了Maze.finish方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: range
# 需要导入模块: from maze import Maze [as 别名]
# 或者: from maze.Maze import finish [as 别名]
current = maze.advance(current, direction)
# Now we need to place the start/finish points
# Find the midpoints
midX = maze.size[0] / 2
midY = maze.size[1] / 2
# Now let's find a point in the top left that's suitable
for y in range(midY):
for x in range(midX):
coord = (x, y)
scan = maze.scan(coord)
if scan.count('#') is 3 and scan.count(' ') is 1:
maze.set(coord, 'S')
maze.start = coord
break
if maze.start != None:
break
# Now look for a finishing point in the bottom right
for y in range(midY):
for x in range(midX):
coord = (x + midX, y+midY)
if scan.count('#') is 3 and scan.count(' ') is 1:
maze.set(coord, 'F')
maze.finish = coord
break
if maze.finish != None:
break
maze.debug()