AI find-path using recursive function