Fixing the sampling of the starting position that caused out of bounds error
This commit is contained in:
parent
021731b740
commit
302017222d
|
@ -92,8 +92,8 @@ class Generator:
|
||||||
walkers = next_walker_pop
|
walkers = next_walker_pop
|
||||||
|
|
||||||
|
|
||||||
start_x, start_y = randint(0, width), randint(0, height)
|
start_x, start_y = randint(0, width-1), randint(0, height-1)
|
||||||
while grid[start_y][start_x] != Tile.FLOOR:
|
while grid[start_y][start_x] != Tile.FLOOR:
|
||||||
start_x, start_y = randint(0, width), randint(0, height)
|
start_x, start_y = randint(0, width-1), randint(0, height-1)
|
||||||
|
|
||||||
return Map(width, height, grid, start_x, start_y)
|
return Map(width, height, grid, start_x, start_y)
|
||||||
|
|
Loading…
Reference in New Issue