Maze generation: Difference between revisions

m
(Added a Perl5 implementation that is different from the Perl6 one)
m (→‎{{header|Perl 5}}: fix headers)
Line 905:
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|Perl 5}}==
 
Tested on Perl 5.8, but should work on any Perl5 installation on most platforms.
Line 911:
This implementation observes that due to the grid formation of the maze, reflection can be used to simplify the algorithm. Walls are only removed on the East (right) and South (bottom) walls (if those walls are not part of the maze boundary).
 
<lang perl5perl>use strict;
 
my $dimension = $ARGV[0] || 7;
Anonymous user