Hi, I'm having some issues with a maze solver that I'm coding for an assignment. Here's what I have so far:
def main(): maze = open(raw_input("Please enter the filename of the maze:"),'r') x=0 y=0 with maze as maze_file: maze = [list(line.strip()) for line in maze_file] for i in maze: #print blank maze for a in i: print a, print print findStart(maze,x,y) print maze[y][x] ##mazeSolve(maze,x,y) #call solver funcion def findStart(maze,x,y): for x and y in range(0,len(maze)): if maze[y][x] == "S": print maze[y][x] return x,y
I do have the solver function coded already, but do not want to post it. My problem lies in the findStart function. I know how to find a single character in a string, but I have absolutely no clue how to do it with a list of lists. Other than that, the only thing I'm wondering is how to remove the spaces that are printed in between characters when I open my maze file.
Here's a sample maze to see the problem with. I threw it in a pastebin because the editor on here messed up the spacing.