Wall-following is a simple maze algorithm you might have learned as a child. All you do to solve a maze using this algorithm is keep your left hand on the left wall (or your right hand on the right wall) and just follow it along until you exit the maze. It's easy to see that this algorithm always works if the maze you're in has an entrance and an exit on its border. However, if the goal is within an island
— a part of the maze that's disconnected from the rest of the maze — this algorithm can't find a solution because it can't "hop" over to the island.
has only its exterior walls and "growing" walls inward
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.