Maze generation: Difference between revisions
→{{header|Javascript}}
(Javascript: showing intermediate results) |
|||
Line 210:
Note however that this leaves the final '#' in place on maze completion, and that the function <code>maze</code> no longer returns a result which represents a generated maze.
Note also that this display suggests an optimization. You can replace the line reading <code>path.push(here= next);</code> with:
<lang javascript> here= next;
if (1 < neighbors.length)
path.push(here);</lang>
And this does indeed save a negligible bit of processing, but the maze algorithm will still be forced to backtrack through a number of locations which have no unvisited neighbors.
=={{header|PicoLisp}}==
|