I’m using a recursive method where the return value of the deepest level of the successful handler will be returned to the caller. All other handlers will return false when they reach an dead end, so eventually the next value is at some level will be used in the repeat loop. So the return value of the highest level of handler will be an list of move codes (created by every handler call) or false when no path could be found at all.
Nigel’s code is more intelligent and doesn’t come to an dead end, only possible values. His AI is more complex for bigger puzzles but the best solution for such a small little puzzle.
Therefore in terms of AI my and Nigel’s example can’t be compared in ways of similarity.