Getting to full cover, and minor fix to bug that allowed corridors to create loops in a room, resulting in implacability

This commit is contained in:
Charles Peyrat 2021-01-10 21:48:12 +01:00
parent 96bbc5088f
commit e639ad6255
2 changed files with 5 additions and 1 deletions

View File

@ -152,7 +152,7 @@ class Generator:
if 0 <= ny < rh and 0 <= nx < rw \
and room[ny][nx] != Tile.EMPTY:
return False
for i in range(length):
for i in range(length+1):
if room[y + i * dy][x + i * dx] != Tile.EMPTY:
return False
for i in range(length):

View File

@ -37,6 +37,10 @@ class TestBroguelike(unittest.TestCase):
queue += Map.neighbourhood(grid, y, x)
return not any([t.can_walk() for row in grid for t in row])
def test_build_doors(self):
m = self.stom(". .\n. .\n. .\n")
self.assertFalse(self.generator.build_door(m.tiles, 1, 1, 0, 1, 2))
def test_connexity(self) -> None:
m = self.generator.run()
self.assertTrue(self.is_connex(m.tiles))