Problem: Discover a path from start to goal
Solution: Begin at start and explore down paths. Whenever there is an
unexplored direction, take it. When at a dead end, back up to the first place
with unexplored paths. Use a stack S to keep a record of the current
path: push onto S as you move forward, pop when backtracking.
The process stops when either the S is empty (implying no solution) or when
goal = S.top() (implying that the contents of the
stack form a solution).
|