fix the print on 42 in the maze

This commit is contained in:
Maoake Teriierooiterai
2026-04-03 14:20:01 +02:00
parent 0045def73b
commit 11947db62f
2 changed files with 10 additions and 7 deletions
+3 -3
View File
@@ -1,7 +1,7 @@
WIDTH=10
HEIGHT=10
WIDTH=15
HEIGHT=15
ENTRY=1,1
EXIT=10,10
EXIT=5,7
OUTPUT_FILE=con
PERFECT=True
GENERATOR=DFS
+7 -4
View File
@@ -20,8 +20,8 @@ class MazeGenerator(ABC):
end: Ending cell coordinates, using 1-based indexing.
perfect: Whether to generate a perfect maze with no loops.
"""
self.start = (start[0] - 1, start[1] - 1)
self.end = (end[0] - 1, end[1] - 1)
self.start = (start[1] - 1, start[0] - 1)
self.end = (end[1] - 1, end[0] - 1)
self.perfect = perfect
@abstractmethod
@@ -347,8 +347,8 @@ class DepthFirstSearch(MazeGenerator):
end: Ending cell coordinates, using 1-based indexing.
perfect: Whether to generate a perfect maze with no loops.
"""
self.start = (start[0] - 1, start[1] - 1)
self.end = (end[0] - 1, end[1] - 1)
self.start = (start[1] - 1, start[0] - 1)
self.end = (end[1] - 1, end[0] - 1)
self.perfect = perfect
self.forty_two: set[tuple[int, int]] | None = None
@@ -379,6 +379,9 @@ class DepthFirstSearch(MazeGenerator):
and self.start not in self.forty_two
and self.end not in self.forty_two
):
print(self.start)
print(self.end)
print(self.forty_two)
visited = self.lock_cell_ft(visited, self.forty_two)
path: list[tuple[int, int]] = list()
w_h = (width, height)