From 302017222d16aad3280d1e89c3a1bcbdfc86c365 Mon Sep 17 00:00:00 2001 From: Charles Peyrat Date: Fri, 11 Dec 2020 01:11:07 +0100 Subject: [PATCH] Fixing the sampling of the starting position that caused out of bounds error --- dungeonbattle/mapgeneration/randomwalk.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dungeonbattle/mapgeneration/randomwalk.py b/dungeonbattle/mapgeneration/randomwalk.py index c9234f9..e93a4e6 100644 --- a/dungeonbattle/mapgeneration/randomwalk.py +++ b/dungeonbattle/mapgeneration/randomwalk.py @@ -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)