Hoopla! » Graph Traversal: solving the 8-puzzle with basic A.I.: "Here’s the simplest way we can find the right node on the given tree.
best = nil
def walk(node)
best = node if best.nil? || node > best
node.children.each {|child| walk child }
end
walk root"
'via Blog this'