diff --git a/expandingModel/example.json b/expandingModel/example.json new file mode 100644 index 0000000..a03f495 --- /dev/null +++ b/expandingModel/example.json @@ -0,0 +1,20 @@ +[ + { + "name": "hall", + "minSize": [2, 2], + "expandable": true, + "neighbors": ["kitchen", "elevator"] + }, + { + "name": "kitchen", + "minSize": [10, 10], + "expandable": true, + "neighbors": ["hall"] + }, + { + "name": "elevator", + "minSize": [4, 4], + "expandable": false, + "neighbors": ["hall"] + } +] \ No newline at end of file diff --git a/expandingModel/print.py b/expandingModel/print.py index ee367f4..64e318c 100644 --- a/expandingModel/print.py +++ b/expandingModel/print.py @@ -17,17 +17,15 @@ def __init__(self, fieldWidth, fieldHeight) -> None: self.inter_display = pygame.Surface((fieldWidth, fieldHeight)) self.inter_display.blit(pygame.transform.flip(self.inter_display, False, True), (0, 0)) - self.offX = fieldWidth/2 - self.offY = fieldHeight/2 + self.offX = self.offY = fieldHeight/2 def getCords(self, x, y): - return (x + self.offX, - y + self.offY) + return (x + self.offX, y + self.offY) def printRect(self, r: Rect, color: tuple) -> None: x, y = self.getCords(r.a.x, r.a.y) pygame.draw.rect(self.inter_display, color, - (x, y, r.width_l + r.width_r, r.height_u + r.height_d)) + (x, y, r.width_l + r.width_r, r.height_u + r.height_d)) def printAll(self) -> None: self.scaleSurface()