Maze Solving Algorithm - Wall Follower

Wall Follower

The wall follower, the best-known rule for traversing mazes, is also known as either the left-hand rule or the right-hand rule. If the maze is simply connected, that is, all its walls are connected together or to the maze's outer boundary, then by keeping one hand in contact with one wall of the maze the player is guaranteed not to get lost and will reach a different exit if there is one; otherwise, he or she will return to the entrance having traversed every corridor in the maze at least once.

Another perspective into why wall following works is topological. If the walls are connected, then they may be deformed into a loop or circle. Then wall following reduces to walking around a circle from start to finish. To further this idea, notice that by grouping together connected components of the maze walls, the boundaries between these are precisely the solutions, even if there is more than one solution (see figures on the right).

If the maze is not simply connected (i.e. if the start or endpoints are in the center of the structure or the pathways cross over and under each other), this method will not be guaranteed to help the goal to be reached.

Wall-following can be done in 3D or higher dimensional mazes if its higher dimensional passages can be projected onto the 2D plane in a deterministic manner. For example, if in a 3D maze "up" passages can be assumed to lead northwest, and "down" passages can be assumed to lead southeast, then standard wall following rules can then be applied. However, unlike in 2D, this requires that the current orientation be known, to determine which direction is the first on the left or right.

Read more about this topic:  Maze Solving Algorithm

Famous quotes containing the word wall:

    Once more unto the breach, dear friends, once more,
    Or close the wall up with our English dead.
    In peace there’s nothing so becomes a man
    As modest stillness and humility,
    But when the blast of war blows in our ears,
    Then imitate the action of the tiger.
    Stiffen the sinews, conjure up the blood,
    Disguise fair nature with hard-favoured rage.
    William Shakespeare (1564–1616)