Angie Hawk wrote:My problems start when my program finds that it's walked down a dead end due to being greedy and needs to retrace steps to try the next quickest route from where it went wrong.
It's hard to be specific but you need to save state in some way as you advance. One way is to push state on a stack so you can pop it back when you retreat. The simplest way usually is to use recursion. Then the state will be preserved when you make a new recursive call and it will be restored again when you return from the call.