Forbid walker from ever reaching the outer most edge of the map
This commit is contained in:
		@@ -48,7 +48,7 @@ class Walker:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    def move_in_bounds(self, width: int, height: int) -> None:
 | 
					    def move_in_bounds(self, width: int, height: int) -> None:
 | 
				
			||||||
        nx, ny = self.next_pos()
 | 
					        nx, ny = self.next_pos()
 | 
				
			||||||
        if 0 < nx < width and 0 < ny < height:
 | 
					        if 0 < nx < width-1 and 0 < ny < height-1:
 | 
				
			||||||
            self.x, self.y = nx, ny
 | 
					            self.x, self.y = nx, ny
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def split(self) -> "Walker":
 | 
					    def split(self) -> "Walker":
 | 
				
			||||||
@@ -106,7 +106,7 @@ class Generator:
 | 
				
			|||||||
        for x in range(width):
 | 
					        for x in range(width):
 | 
				
			||||||
            for y in range(height):
 | 
					            for y in range(height):
 | 
				
			||||||
                if grid[y][x] == Tile.EMPTY:
 | 
					                if grid[y][x] == Tile.EMPTY:
 | 
				
			||||||
                    c = sum([1 if grid[j][i] == Tile.FLOOR else 0 for j, i in Map.neighbourhood(grid, y, x, large=True)])
 | 
					                    c = sum([1 if grid[j][i] == Tile.FLOOR else 0 for j, i in Map.neighbourhood(grid, y, x)])
 | 
				
			||||||
                    if c == 4 and self.params["no_lone_walls"]:
 | 
					                    if c == 4 and self.params["no_lone_walls"]:
 | 
				
			||||||
                        result.tiles[y][x] = Tile.FLOOR
 | 
					                        result.tiles[y][x] = Tile.FLOOR
 | 
				
			||||||
                    elif c > 0:
 | 
					                    elif c > 0:
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user