Depth-Limited search, p. 77 AI Modern Approach


function Recursive-DLS(ladder, target, limit) returns a solution or failure/cutoff - can return [] or ladder
   cutoff_occurred? <-- false
   if GOAL-TEST(target) == true
     return SOLUTION -- or return ladder
   else if DEPTH = limit then return cutoff - such as false or []
   else
     for each successor in EXPAND(node) do  -- or EXPAND(ladder,word)
       result <-- RECURSIVE-DLS(ladder, target, limit-1)
       if result == cutoff then cutoff_occurred? == true
       else
         if result != failure then return result -- or return ladder
   if cutoff_occurred? 
     then return cutoff else return failure
     -- or return false or [] or ladder so far