I need some help in writing a set of if-then rules for traversing a maze. This is the problem:
"Assume that the maze is constructed on a grid of square cells by placing walls across some of the edges of cells in such a way that there is a path from any cell within the maze to an outer edge of the maze that has no wall.
One way is left-hand rule, but this strategy can take you around in cycles.
Write if-then rules in English for traversing the wall and detecting a cycle. Assume you know size of grid and max distance you may have to travel to escape the maze."
This is what I have so far:
Start
If only one path (Left or Right or Straight) is found, follow the path.
Else If Multiple path is found:
If left path is found, take a left turn.
Else if straight path is found, follow straight path.
Else if right path is found, take a right turn.
Else If Dead End is found, take a 'U' turn.
Go To step 2
End
But this is not solving the cycle problem. Can anyone help please?