资 源 简 介
用堆栈实现迷宫求解问题
基本思想:
若当前位置可以通过,则压入栈中,否则探求下一位置,若走不通,则回朔,迷宫大小:M*N.迷宫设置自定义。
求解迷宫问题的简单方法是:从入口出发,沿某一方向进行探索,若能走通,则继续向前走;否则沿原路返回,换一方向再进行探索,直到所有可能的通路都探索到为止。
为避免走回到已经进入的点(包括已在当前路径上的点和曾经在当前路径上的点),凡是进入过的点都应做上记号。-Maze with the stack to achieve the basic idea for solving the problem: If the current position can be adopted, in pressure, otherwise the next location to explore, if a dead end, then back to New Moon, the size of the maze: M* N. maze set up a custom. A simple maze to solve the problem is: starting from the entrance, along a certain direction to explore, can walk, then continue to move forward otherwise return along the same route, a direction for further exploration, until all possible pathways are exploring to date. In order to avoid going back to have access points (including the current path and current path in the point), all the points should be entered mark.