Force loop entrance to get coverage

This commit is contained in:
Charles Peyrat 2021-01-08 14:52:59 +01:00
parent c06f903a16
commit fab1bee8d8

View File

@ -96,8 +96,8 @@ class Generator:
next_walker_pop.append(walker.split())
walkers = next_walker_pop
start_x, start_y = randint(0, width - 1), randint(0, height - 1)
while grid[start_y][start_x] != Tile.FLOOR:
start_x, start_y = -1, -1
while grid[start_y][start_x] != Tile.FLOOR or start_x == -1:
start_x, start_y = randint(0, width - 1), randint(0, height - 1)
result = Map(width, height, grid, start_y, start_x)