[Tutor] Need Maze traverse to move through start and find exit. replacing x on the path.

Ravinder Singh grewal06 at gmail.com
Mon Apr 5 22:55:18 CEST 2010


I do not know the code to move the traversal.
Maze = [ [ '#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#'
],\
         [ '#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#'
],\
         [ '#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#'
],\
         [ '.','.','.','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#'
],\
         [ '#','#','.','#','#','.','.','#','#','#','#','#','#','#','#','#','#','#','#','#'
],\
         [ '#','#','.','#','#','.','.','#','#','#','#','#','#','#','#','#','#','.','.','.'
],\
         [ '#','#','.','#','#','.','.','#','#','#','#','#','#','#','#','#','#','.','#','#'
],\
         [ '#','#','.','.','.','.','#','#','#','#','#','#','#','#','#','#','#','.','#','#'
],\
         [ '#','#','.','#','#','.','#','#','#','#','#','#','.','.','.','.','.','.','#','#'
],\
         [ '#','#','.','#','#','.','#','#','#','#','#','#','.','#','#','#','#','.','#','#'
],\
         [ '#','#','.','#','#','.','#','#','#','#','#','#','.','#','#','#','#','.','#','#'
],\
         [ '#','#','#','#','#','.','.','.','.','.','.','.','.','#','#','#','#','#','#','#'
],\
         [ '#','#','#','#','#','#','#','#','#','#','#','#','.','#','#','#','#','#','#','#'
],\
         [ '#','#','#','#','#','#','#','#','#','#','#','#','.','#','#','#','#','#','#','#'
],\
         [ '#','#','#','#','#','#','#','#','#','#','#','#','.','#','#','#','#','#','#','#'
],\
         [ '#','#','#','#','#','#','#','#'
,'#','#','#','#','.','#','#','#','#','#','#','#' ],\
         [ '#','#','#','#','#','#','#','#','#','#','#','#','.','#','#','#','#','#','#','#'
],\
         [ '#','#','#','#','#','#','#','#','#','#','#','#','.','#','#','#','#','#','#','#'
],\
         [ '#','#','#','#','#','#','#','#','#','#','#','#','.','#','#','#','#','#','#','#'
],\
         [ '#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#'
],\
]
x= "x"
Squares= 399
def PrintMaze():
    global Maze
    return "\n".join(' '.join(row) for row in Maze)

print(PrintMaze())

def MazeTraverse(Srow, col):
    Maze = []
    for i in range(Squares):
        Maze[4]= "x"
        return "\n".join(' '.join(row) for row in Maze)

print(MazeTraverse(60,61))

thanks


More information about the Tutor mailing list