本文整理汇总了Python中maze.Maze.advance方法的典型用法代码示例。如果您正苦于以下问题:Python Maze.advance方法的具体用法?Python Maze.advance怎么用?Python Maze.advance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类maze.Maze
的用法示例。
在下文中一共展示了Maze.advance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1:
# 需要导入模块: from maze import Maze [as 别名]
# 或者: from maze.Maze import advance [as 别名]
try:
finish = around.index('F')
# Mark off the last breadcrumb
maze.set(current, '.')
solved = True
break
except ValueError:
pass
# Guess not, let's go on
try:
direction = around.index(' ')
# Place a breadcrumb and move forward one space in that direction
if maze.get(current) != 'S':
maze.set(current, '.')
current = maze.advance(current, direction)
except ValueError:
# There's no space, so we're going to have to go back a space
try:
direction = around.index('.')
# Place an explored breadcrumb and go back
maze.set(current, '-')
current = maze.advance(current, direction)
except ValueError:
print("Something went wrong! ", current)
maze.debug()
sys.exit(1)
mazec = ""
for line in maze.maze:
for char in line: