diff --git a/world_maker/pack_rectangle.py b/world_maker/pack_rectangle.py index c279d94..5a87dbd 100644 --- a/world_maker/pack_rectangle.py +++ b/world_maker/pack_rectangle.py @@ -57,25 +57,6 @@ class Bin: self.grid[rect_y][rect_x] = False -def pack_rectangles(rectangles, grid): - rectangles = sorted( - rectangles, key=lambda r: r.width * r.height, reverse=True) - bins = [Bin(grid)] - - for rectangle in rectangles: - for bin in bins: - if bin.place_rectangle(rectangle): - break - else: - new_bin = Bin(grid) - if new_bin.place_rectangle(rectangle): - bins.append(new_bin) - else: - return False - - return True - - def generate_rectangle(min_width: int = 10, max_width: int = 25): width = randint(min_width, max_width) height = randint(min_width, max_width) @@ -117,5 +98,3 @@ def generate_building(image: Union[str, Image], heightmap: Union[str, Image], ou return rectangles -if __name__ == '__main__': - generate_building()