diff --git a/src/amaz-lib/__init__.py b/src/amaz-lib/__init__.py index 70704a3..b47ab7d 100644 --- a/src/amaz-lib/__init__.py +++ b/src/amaz-lib/__init__.py @@ -1,5 +1,5 @@ from .classes.Cell import Cell __version__ = "1.0.0" -__author__ = "nous" +__author__ = "us" __all__ = ["Cell"] diff --git a/src/amaz-lib/classes/Maze.py b/src/amaz-lib/classes/Maze.py new file mode 100644 index 0000000..b6fcfbf --- /dev/null +++ b/src/amaz-lib/classes/Maze.py @@ -0,0 +1,15 @@ +from sys import stdout +import numpy as np +from pydantic import BaseModel + + +class Maze(BaseModel): + maze: np.ndarray + + def __str__(self) -> str: + res = "" + for _ in self.maze: + for cell in self.maze: + res += cell + res += "\n" + return res diff --git a/src/amaz-lib/generators/kruskal.py b/src/amaz-lib/generators/kruskal.py index 35032de..e1737e7 100644 --- a/src/amaz-lib/generators/kruskal.py +++ b/src/amaz-lib/generators/kruskal.py @@ -3,5 +3,13 @@ import numpy as np from .. import Cell -def kraskal(height: int, width: int) -> Generator[None, None, None]: +def kraskal( + height: int, width: int +) -> Generator[np.ndarray, None, np.ndarray]: maze = np.array([[Cell(value=15) for _ in range(height)] * width]) + cells_checked = np.array([[False for _ in range(height)] * width]) + excepted_end = np.array([[True for _ in range(height)] * width]) + + while cells_checked != excepted_end: + yield maze + return maze