if filename upper(='list' print('maze files found in'os getcwd() for fileincurrentfolder in os listdir() if (fileincurrentfolder startswith('maze'and fileincurrentfolder endswith(txt')) print('fileincurrentfolder continue if filename upper(='quit' sys exit( if os path exists(filename) break print('there is no file named'filename load the maze from file mazefile open(filename maze { lines mazefile readlines( playerx none playery none exitx none exity none for line in lines width len(line rstrip() for xcharacter in enumerate(line rstrip()) assert character in (wallemptystartexit)'invalid character at column {}line {}format( if character in (wallempty) maze[(xy)character elif character =start playerxplayery xy maze[(xy)empty elif character =exit exitxexity xy maze[(xy)empty + height assert playerx !none and playery !none'no start in maze file assert exitx !none and exity !none'no exit in maze file while truemain game loop displaymaze(maze while trueget user move print( ' print('enter directionor quitasd' move input(''upper( if move ='quit' print('thanks for playing!' sys exit( project #