Find the best path on the grid