A rat is placed in a maze at some unknown position in the maze.
All we can go is in up, down, right or left directions. And we have two methods:
- tryMove(<direction>) which returns false if there is a wall and true if we can move.
- bool hasLadder(): which returns true if there is a ladder to escape.
We have to write a function explore which returns true if we find the way out or false if there is no way.
This is a simple graph problem and can be solved using bfs or a dfs algorithm if we can find mark these places. If we cannot mark these places we can move in cycles visiting the same places. Can some one help me to get rat out of the maze please if its unmarked? Is it possible?