search a path within a maze recursively

Your program finds all paths through the maze; if you want to stop it, you need to change your invocations to stop traversing the maze if you hit success:

  found = search_maze(maze, track, rows, cols, x, y + 1, steps);
  swap(maze, y, x, y + 1, x);
  if (found) {
      return found;
  }

At all of the recursive invocations.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top