Draft
Through the Maze
Description:
Can you get through mazes?
var maze= [ [ '_', '_', '_', 'W', '_', '_' ],
[ 'W', 'W', '_', 'W', '_', '_' ],
[ 'W', 'W', '_', '_', 'W', '_' ],
[ '_', 'W', '_', '_', '_', 'W' ],
[ '_', '_', '_', '_', '_', 'x' ],
[ 'W', 'W', 'W', 'W', 'W', 'W' ] ]
Maze rules:
- Start from the top left corner, and get to "x" in vertical or horizontal steps of 1.
- You are allowed to move left, right, or down. For simplicity, the maze format will not require you to move upwards, although it is not prohibited by any test.
- Only "_" and "x" cells are valid. Do not hit walls ("W" cells);
- Do not go out of the maze's bounds;
- Stop after finding x.
Your solution shall be an object containing the "path" and "values" keys.
- "path" array keeps track of all the cells in the maze (see "toXpath" array in sample test case);
- "values" array keeps track of all encountered cells contents. (see toXvalues array in sample test case);
Assumptions:
- A Maze will have NxN cells, where N is an integer between 5 and 100;
- Random (>=1) number of walls ("W"-cells-only rows) at the bottom of the maze.
- "x" is located in the row just above the series of wall-rows.
- The test cases do not require a specific path to be taken.
Arrays
Strings
Similar Kata:
Stats:
Created | Dec 3, 2015 |
Warriors Trained | 89 |
Total Skips | 0 |
Total Code Submissions | 352 |
Total Times Completed | 24 |
JavaScript Completions | 24 |
Total Stars | 7 |
% of votes with a positive feedback rating | 75% of 10 |
Total "Very Satisfied" Votes | 7 |
Total "Somewhat Satisfied" Votes | 1 |
Total "Not Satisfied" Votes | 2 |
Total Rank Assessments | 12 |
Average Assessed Rank | 4 kyu |
Highest Assessed Rank | 3 kyu |
Lowest Assessed Rank | 6 kyu |