Maze-solving algorithm: Difference between revisions

Content deleted Content added
move image up; doesn't seem specific to pledge algorithm, article needs a lead image, and its earlier placement was interfering with the Tremaux figure placement
Trémaux's algorithm: In particular this case should occur whenever you reach a dead end.
Line 37:
* If you arrive at a junction that has no marks (other than the one on the edge by which you entered), choose an arbitrary unmarked path, follow it, and mark it.
* Otherwise:
** If the path you came in on has only one mark, turn around and return along that path, marking it again. In particular this case should occur whenever you reach a dead end.
** If not, choose arbitrarily one of the remaining paths with the fewest number of marks (zero if possible, else one), follow that path, and mark it.
When you finally reach the solution, paths marked exactly once will indicate a way back to the start. If there is no exit, this method will take you back to the start where all paths are marked twice.