From fab1bee8d82a5ac63bcb50bacabd68fe989f4edc Mon Sep 17 00:00:00 2001 From: Charles Peyrat Date: Fri, 8 Jan 2021 14:52:59 +0100 Subject: [PATCH] Force loop entrance to get coverage --- squirrelbattle/mapgeneration/randomwalk.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/squirrelbattle/mapgeneration/randomwalk.py b/squirrelbattle/mapgeneration/randomwalk.py index 913599f..688c92c 100644 --- a/squirrelbattle/mapgeneration/randomwalk.py +++ b/squirrelbattle/mapgeneration/randomwalk.py @@ -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)