From 59f9d647d5132209256e77fe66797a7553c2ec16 Mon Sep 17 00:00:00 2001 From: NichiHachi Date: Sun, 16 Jun 2024 22:56:33 +0200 Subject: [PATCH] Le 0Head qui a mal pull --- world_maker/pack_rectangle.py | 21 --------------------- 1 file changed, 21 deletions(-) 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()