5 kyu
Navigating a Maze
86alekseil
Description:
Your task is to find the path between two points inside a square maze. The mazes are generated using Eller's algorithm, so there is only one possible path between any two points. Mazes look like this:
#######
# # #
# # ### S - start point
# G# G - goal point
### # # # - walls of the maze
#S # #
#######
Implement the FindPath method, which returns an array of traversed indices to reach the goal point from the start point.
Available input data:
maze - flat 1D array where True shows a passable space and False means a wall
size - length of one side of the maze including borders (maze is square)
startIndex - the index of the cell in the maze array to start your path from
goalIndex - the index of the cell in the maze array to reach
In the maze above S has index 36 and G has index 26 in the maze array, so the correct path would be through these cells:
{ 36, 37, 38, 31, 24, 25, 26 }
There are some static tests and some random tests with mazes of different sizes.
Algorithms
Graph Theory
Similar Kata:
Stats:
Created | Feb 26, 2016 |
Published | Feb 26, 2016 |
Warriors Trained | 553 |
Total Skips | 148 |
Total Code Submissions | 325 |
Total Times Completed | 86 |
C# Completions | 86 |
Total Stars | 32 |
% of votes with a positive feedback rating | 92% of 38 |
Total "Very Satisfied" Votes | 34 |
Total "Somewhat Satisfied" Votes | 2 |
Total "Not Satisfied" Votes | 2 |
Total Rank Assessments | 3 |
Average Assessed Rank | 5 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 6 kyu |