listing the solvemaze py program program for building and solving maze from maze import maze the main routine def main()maze buildmaze"mazefile txtif maze findpath(print"path found maze draw(else print"path not found builds maze based on text format in the given file def buildmazefilename )infile openfilename"rread the size of the maze nrowsncols readvaluepairinfile maze mazenrowsncols read the starting and exit positions rowcol readvaluepairinfile maze setstartrowcol rowcol readvaluepairinfile maze setexitrowcol read the maze itself for row in rangenrows line infile readline(for col in rangelen(lineif line[col="*maze setwallrowcol close the maze file and return the newly constructed maze infile close(return maze extracts an integer value pair from the given input file def readvaluepairinfile )line infile readline(valavalb line split(return int(vala)int(valbcall the main routine to execute the program main(maze text file format before searching for path through the mazewe must first build maze the maze can be constructed directly within the program by calls to setwall(with literal indices or we can read maze specification from text file suppose maze is represented in text file using the following format