Skip to content

Latest commit

 

History

History
29 lines (22 loc) · 888 Bytes

maze.md

File metadata and controls

29 lines (22 loc) · 888 Bytes

Maze Solver

 ___________________
|_  |  ___     _   _|
| | |  _|___| |_  | |
|  _____|_  |  _|   |
| | |  _  |  _|_  | |
|___| | | |  _  | | |
| |_  |  _____| | |_|
| |___| |  _|   |_  |
|     | |___  |_  | |
|_| | |  _  |_| |_| |
|___|___|_______|___|

Task

Write a function that reads in a string representation of a maze and outputs a string of letters; N, S, E or W where each letter corresponds to North, South, East or West such that the maze is solved from the top left corner to the bottom right.

Input

" ___________________ \n|_  |  ___     _   _|\n| | |  _|___| |_  | |\n|  _____|_  |  _|   |\n| | |  _  |  _|_  | |\n|___| | | |  _  | | |\n| |_  |  _____| | |_|\n| |___| |  _|   |_  |\n|     | |___  |_  | |\n|_| | |  _  |_| |_| |\n|___|___|_______|___|\n"

Output

"ESSENNEEEEEESSSSSSESSS"