possibleRoad is a multidimensional list. This code just needs a lot of if without else but the last if is giving me the error Expected:else. I'm so confused because this is how I've been using indentation with no trouble and if statement can be used alone without else. Am I missing something? I would appreciate any help.
def checkRoad(row, col):
possibleRoad.clear()
if(row+1 <= mazeSize):
if(maze[row+1][col]!='1' and maze[row+1][col]!='5'):
possibleRoad.append((row+1,col))
if(row-1 >= 1):
if(maze[row-1][col]!='1' and maze[row-1][col]!='5'):
possibleRoad.append((row-1,col))
if(col-1 >= 0):
if(maze[row][col-1]!='1' and maze[row][col-1]!='5'):
possibleRoad.append((row, col-1))
if(col+1 <= mazeSize):
if(maze[row][col+1]!='1' and maze[row][col+1]!='5'):
possibleRoad.append((row,col+1)
if(possibleRoad):
possibleRoad.append()
Aucun commentaire:
Enregistrer un commentaire