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

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)