Maze-solving algorithm: Difference between revisions

Content deleted Content added
Tags: Mobile edit Mobile web edit Advanced mobile edit
No edit summary
Tags: Mobile edit Mobile web edit Advanced mobile edit
Line 58:
This is in effect a depth-first search expressed in term of grid points. The omniscient view prevents entering loops by memoization. Here is a sample code in [[Java (programming language)|Java]]:
<syntaxhighlight lang="java">
boolean[][] maze = new intboolean[width][height]; // The maze
boolean[][] wasHere = new boolean[width][height];
boolean[][] correctPath = new boolean[width][height]; // The solution to the maze