Fixed maze converting
This commit is contained in:
parent
0aad8728ff
commit
327f0d8f65
8
maze.py
8
maze.py
|
@ -199,16 +199,16 @@ class VectorWrapper(Maze):
|
|||
|
||||
while stack:
|
||||
x, y = stack.pop()
|
||||
if x - 1 >= 0 and cells[y][x - 1] == VectorEnum.Null and maze[cls.__from_vec(x) - 1, cls.__from_vec(y)]:
|
||||
if x - 1 >= 0 and cells[y][x - 1] == VectorEnum.Null and not maze[cls.__from_vec(x) - 1, cls.__from_vec(y)]:
|
||||
stack.append((x - 1, y))
|
||||
cells[y][x - 1] = VectorEnum.Right
|
||||
if x + 1 < width and cells[y][x + 1] == VectorEnum.Null and maze[cls.__from_vec(x) + 1, cls.__from_vec(y)]:
|
||||
if x + 1 < width and cells[y][x + 1] == VectorEnum.Null and not maze[cls.__from_vec(x) + 1, cls.__from_vec(y)]:
|
||||
stack.append((x + 1, y))
|
||||
cells[y][x + 1] = VectorEnum.Left
|
||||
if y - 1 >= 0 and cells[y - 1][x] == VectorEnum.Null and maze[cls.__from_vec(x), cls.__from_vec(y) - 1]:
|
||||
if y - 1 >= 0 and cells[y - 1][x] == VectorEnum.Null and not maze[cls.__from_vec(x), cls.__from_vec(y) - 1]:
|
||||
stack.append((x, y - 1))
|
||||
cells[y - 1][x] = VectorEnum.Down
|
||||
if y + 1 < height and cells[y + 1][x] == VectorEnum.Null and maze[cls.__from_vec(x), cls.__from_vec(y) + 1]:
|
||||
if y + 1 < height and cells[y + 1][x] == VectorEnum.Null and not maze[cls.__from_vec(x), cls.__from_vec(y) + 1]:
|
||||
stack.append((x, y + 1))
|
||||
cells[y + 1][x] = VectorEnum.Up
|
||||
|
||||
|
|
Loading…
Reference in New Issue