best-first-search implemented