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:
parent
96bbc5088f
commit
e639ad6255
|
@ -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):
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Reference in New Issue