A Mazing!

From programming_contest
Jump to navigation Jump to search

This problem asks you to create an algorithm which finds the exit of a maze. The catch is that the grader is "interactive," namely that you tell it where you want the robot to move, and it tells you whether there is a wall or not. Not having the full view of the maze makes this problem interesting.

The algorithm, however, is the same as solving most mazes...namely, a DFS. We have four edges at most from any given node, and each x,y position encodes a single node.

We must take special care not to re-enter nodes and to remember which direction we are facing when entering a node.