]> Untitled Git - axy/ft/a-maze-ing.git/commitdiff
Fixed for non-square mazes
authorAxy <gilliardmarthey.axel@gmail.com>
Thu, 5 Feb 2026 01:58:15 +0000 (02:58 +0100)
committerAxy <gilliardmarthey.axel@gmail.com>
Thu, 5 Feb 2026 01:58:15 +0000 (02:58 +0100)
__main__.py
amazeing/display.py
amazeing/maze.py

index 8848e9e08aff8b3e18624a9628ebf58a18d6dae5..d19e4a60ff958ee7c470f2fbee93696d0acdaed8 100644 (file)
@@ -1,7 +1,7 @@
 from amazeing import *
 import random
 
-maze = Maze(10, 10)
+maze = Maze(10, 30)
 maze.outline()
 empty = list(maze.walls_empty())
 random.shuffle(empty)
@@ -9,7 +9,7 @@ for wall in empty:
     if maze.wall_maintains_topology(wall):
         maze.fill_wall(wall)
 
-backend = TTYBackend(10, 10)
+backend = TTYBackend(10, 30)
 backend.set_style("#")
 for wall in maze.walls_full():
     for pixel in wall.pixel_coords():
index 835e1a00a0ad35cd88ceb25beec9a982cb897c98..5d4f973239baa3744e152540b3e3d8681d21af7d 100644 (file)
@@ -22,7 +22,7 @@ class TTYBackend(Backend):
         self.height: int = maze_height * 2 + 1
         self.style: str = style
         self.lines: list[list[str]] = [
-            [style for _ in range(0, self.width)] for _ in range(0, self.height)
+            [style for _ in range(0, self.height)] for _ in range(0, self.width)
         ]
 
     def draw_pixel(self, pos: PixelCoord) -> None:
index 0a96aa99edf699db9374f0668efa8976e9c5438f..8919b9f8d4c494c451e9a72c3da87ff0661df307 100644 (file)
@@ -93,8 +93,8 @@ class Maze:
 
     def all_walls(self) -> Generator[WallID]:
         for orientation, a_count, b_count in [
-            (Orientation.HORIZONTAL, self.width + 1, self.height),
-            (Orientation.VERTICAL, self.height + 1, self.width),
+            (Orientation.HORIZONTAL, self.height + 1, self.width),
+            (Orientation.VERTICAL, self.width + 1, self.height),
         ]:
             for a in range(0, a_count):
                 for b in range(0, b_count):
@@ -162,6 +162,7 @@ class Maze:
         ]:
             for a in a_iter:
                 for b in b_iter:
+                    print(f"{a}, {b}, {orientation}")
                     self.fill_wall(WallID(orientation, a, b))
 
     def walls_full(self) -> Iterable[WallID]: