Description: Robot in Maze(TOJ 2470)——(b3.cpp)
There is a robot trapped in the maze. Now you have to send out some instructions, telling it how to reach its destination.
The maze is an M* N grid. Some of the cells are empty, while others are occupied by the wall. Of course the robot can t move into the wall, and the robot can t move outside the grid too. The robot can only accept three commands: TURN LEFT, TURN RIGHT and GO. The robot may face to North, South, East or West during the movement. When it receive a TURN LEFT command, it will rotate 90 degree to the left. That is, if it faces to east before the command, it will face to north after the TURN LEFT command. The TURN RIGHT command is almost the same, except that the direction is opposite. When receive the GO command, the robot will move 1 unit towards its orientation, unless there is a nonempty cell in front of it.
Please note the robot is always face to north at the beginning, i.e., face to the upper border in the maze map. (The
To Search:
File list (Check if you may need any files):
wxb3.exe