Returning an index out of range error, someone please help!
def floodfill(maze, x, y, a, b):
#maze[x][y] = b
for i in range(1,len(maze)):
for j in range(len(maze[i])):
if maze[i-1][j] == a or [i][j-1] == a or maze[i-1][j] == b or maze[i][j-1] == b:
if maze[i][j] == a:
maze[i][j] = b
return maze
here is the "maze" being solved.... the flood fill is supposed to change all 0 into 1
[[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1],
[0, 0, 0, 0, 0, 0, -1, 0, -1, 0, -1],
[-1, 0, -1, -1, -1, 0, -1, 0, -1, 0, -1],
[-1, 0, -1, 0, 0, 0, -1, 0, -1, 0, -1],
[-1, 0, -1, -1, -1, -1, -1, 0, -1, 0, -1],
[-1, 0, 0, 0, 0, 0, 0, 0, -1, 0, -1],
[-1, 0, -1, -1, -1, -1, -1, -1, -1, 0, -1],
[-1, 0, -1, 0, 0, 0, 0, 0, 0, 0, -1],
[-1, 0, -1, -1, -1, -1, -1, -1, -1, 0, -1],
[-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]]