Content deleted Content added
Artoria2e5 (talk | contribs) Tags: Mobile edit Mobile web edit Advanced mobile edit |
Artoria2e5 (talk | contribs) No edit summary Tags: Mobile edit Mobile web edit Advanced mobile edit |
||
Line 56:
If given an omniscient view of the maze, a simple recursive algorithm can tell one how to get to the end. The algorithm will be given a starting X and Y value. If the X and Y values are not on a wall, the method will call itself with all adjacent X and Y values, making sure that it did not already use those X and Y values before. If the X and Y values are those of the end ___location, it will save all the previous instances of the method as the correct path.
This is in effect a depth-first search
<syntaxhighlight lang="java">
int[][] maze = new int[width][height]; // The maze
|