Maze solving: Difference between revisions

m (→‎{{header|Perl 6}}: Update works-with. Niecza is no longer maintained.)
Line 666:
 
=={{header|D}}==
{{incorrect|D|Is output double spaced, with only two dots above the E rather than 4, see comment [[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 06:09, 19 March 2017 (UTC)}}
This entry reads a maze generated by http://rosettacode.org/wiki/Maze_generation#D and chooses two random start-end points.
<lang d>import std.stdio, std.random, std.string, std.array, std.algorithm,
Line 682 ⟶ 683:
if (maze[s.y + (d.y / 2)][s.x + (d.x / 2)] == ' ' &&
maze[s.y + d.y][s.x + d.x] == ' ') {
//Would this help?
// maze[s.y + (d.y / 2)][s.x + (d.x / 2)] = pathSymbol;
maze[s.y + d.y][s.x + d.x] = pathSymbol;
if (solveMaze(maze, V2(s.x + d.x, s.y + d.y), end))
7,833

edits