fixing the DFS and modify the main

This commit is contained in:
Maoake TERIIEROOITERAI committed 2026-03-24 20:47:13 +01:00
1 parent 991cdead51
commit 8eb46f601f
2 files changed
+2 -4

No files matched your search

+1 -2
View File
@@ -7,8 +7,7 @@ import src.amaz_lib as g
def main(maze_gen: MazeGenerator) -> None: def main(maze_gen: MazeGenerator) -> None:
# try: # try:
maze = Maze(maze=None) maze = Maze(maze=None)
generator = Kruskal() for alg in maze_gen.generator(30, 10):
for alg in generator.generator(50, 50):
maze.set_maze(alg) maze.set_maze(alg)
os.system("clear") os.system("clear")
maze.ascii_print() maze.ascii_print()
+1 -2
View File
@@ -1,5 +1,4 @@
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import Generator, Set from typing import Generator, Set
import numpy as np import numpy as np
from .Cell import Cell from .Cell import Cell
@@ -107,7 +106,7 @@ class Kruskal(MazeGenerator):
class DepthFirstSearch(MazeGenerator): class DepthFirstSearch(MazeGenerator):
def generator( def generator(
self, width: int, height: int self, height: int, width: int
) -> Generator[np.ndarray, None, np.ndarray]: ) -> Generator[np.ndarray, None, np.ndarray]:
maze = DepthFirstSearch.init_maze(width, height) maze = DepthFirstSearch.init_maze(width, height)
visited = np.zeros((height, width), dtype=bool) visited = np.zeros((height, width), dtype=bool)