Fixing the sampling of the starting position that caused out of bounds error

This commit is contained in:
Charles Peyrat 2020-12-11 01:11:07 +01:00
parent 021731b740
commit 302017222d
1 changed files with 2 additions and 2 deletions

View File

@ -92,8 +92,8 @@ class Generator:
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:
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)