My assignment says:
2 miners are trapped in a mine after an avalanche. Fortunately they have found a passage to get out. That passage is too small for both of them. Well they came to the conclusion that one will enter that passage and the other one will be given instructions how to pass from that passage when the first miners is up. If the dimensions of the mine, the map, the trapped miner's position, the passage, and the exit are given write a program which tells how to go to the exit,
Input (Keyboard)
2 integers n,m (n>=50 m>=50) the width and lenght
the map where
* the position of the miner
X exit
. passage
# closed from the avalanche
Output (Screen)
instructions N, E, S, W,
for north east south west
Example:
input:
4 4
*.##
#..#
##.#
X..#
output:
ESESSWW
I know that it must be solved using graphs but i don't know how.
Can anybody help me?