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:
		@@ -152,7 +152,7 @@ class Generator:
 | 
				
			|||||||
            if 0 <= ny < rh and 0 <= nx < rw \
 | 
					            if 0 <= ny < rh and 0 <= nx < rw \
 | 
				
			||||||
                    and room[ny][nx] != Tile.EMPTY:
 | 
					                    and room[ny][nx] != Tile.EMPTY:
 | 
				
			||||||
                return False
 | 
					                return False
 | 
				
			||||||
        for i in range(length):
 | 
					        for i in range(length+1):
 | 
				
			||||||
            if room[y + i * dy][x + i * dx] != Tile.EMPTY:
 | 
					            if room[y + i * dy][x + i * dx] != Tile.EMPTY:
 | 
				
			||||||
                return False
 | 
					                return False
 | 
				
			||||||
        for i in range(length):
 | 
					        for i in range(length):
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -37,6 +37,10 @@ class TestBroguelike(unittest.TestCase):
 | 
				
			|||||||
                queue += Map.neighbourhood(grid, y, x)
 | 
					                queue += Map.neighbourhood(grid, y, x)
 | 
				
			||||||
        return not any([t.can_walk() for row in grid for t in row])
 | 
					        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:
 | 
					    def test_connexity(self) -> None:
 | 
				
			||||||
        m = self.generator.run()
 | 
					        m = self.generator.run()
 | 
				
			||||||
        self.assertTrue(self.is_connex(m.tiles))
 | 
					        self.assertTrue(self.is_connex(m.tiles))
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user