Maze Path Finder
Description:
Find a path throug the maze. Start at point A and goto point B. There could be more than one possible path to point B. The goal is to find a way arround the walls. Point A and B can be anyware inside the maze.
Given will be a maze, made of a 2 dimentional array of chars.
Example maze:
[
['.','.','.','.','.','.'],
['.','#','#','#','#','.'],
['.','#','B','.','#','.'],
['.','.','.','.','#','.'],
['#','#','#','#','#','.'],
['A','.','.','.','.','.']
]
The starting point is marked with an upper case A
, the destination will be marked with a upper case B
.
Walls will be marked with a hashtag #
. Periots .
will make passable spaces.
If you walk into a Wall (#) the test will fail.
Return the path as a string defining the way with the letters of the four cardinal points (lower case).
the directions are oriented in the way the maze is displayed inside the code.
n = North (negative y)
e = East (negative x)
w = West (positive x)
s = South (positive y)
(maze array first dimention will be y, second will be x)
Example path:
"eeeeennnnnwwwwwssseen"
If there is no available path return an empty string.
There will allways be exactly one starting point (A) and exactly one destination point (B).
The maze will allways be a rectangle. (No different line lengths.)
You cant go diagonal.
Mazes will be generated randomly!
Similar Kata:
Stats:
Created | Feb 10, 2020 |
Warriors Trained | 18 |
Total Skips | 0 |
Total Code Submissions | 70 |
Total Times Completed | 5 |
JavaScript Completions | 5 |
Total Stars | 1 |
% of votes with a positive feedback rating | 17% of 3 |
Total "Very Satisfied" Votes | 0 |
Total "Somewhat Satisfied" Votes | 1 |
Total "Not Satisfied" Votes | 2 |
Total Rank Assessments | 4 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 4 kyu |
Lowest Assessed Rank | 8 kyu |