def dfsPathSearch(grid,
                  startIndex,
                  goalIndex,
                  pathSoFar,
                  visitedNodes):
    # Marking the current node as explored
    visitedNodes.add(startIndex)
    # Base case of recursion in case we want to stop 
    # after certain condition
    if(startIndex == goalIndex):
        return True
    else: # Recursive steps
        # Generate all valid surrounding points
        s = genSurr(grid,startIndex[0],startIndex[1])
        validChars = set()
        validChars.add('.')
        validChars.add('*')
        sValid = genValidSurr(grid,s,validChars,visitedNodes)
        # Return False in case no valid surrounding pt found
        if(len(sValid) == 0): return False
        # Iterate through all valid surrouding points
        for point in sValid:
            pathExists = dfsPathSearch(grid,
                                       point,
                                       goalIndex,
                                       pathSoFar,
                                       visitedNodes)  
            if(pathExists):
                # If there were more than one choices here, increment
                # wand use by one
                pathSoFar.append(point)
                return True
        # Return false if no point in valid surroundings
        # can generate a path to goal
        return False