diff --git a/a_maze_ing.py b/a_maze_ing.py index 41d147f..d137ea5 100644 --- a/a_maze_ing.py +++ b/a_maze_ing.py @@ -486,8 +486,7 @@ def main() -> None: config = Parsing.get_data_maze("config.txt") amazing = AMazeIng(**config) mlx.start(amazing) - with open("test.txt", "w") as output: - output.write(amazing.__str__()) + amazing.export_maze() except Exception as err: print(err) finally: diff --git a/config.txt b/config.txt index febdc6b..f0c23c7 100644 --- a/config.txt +++ b/config.txt @@ -1,8 +1,8 @@ -WIDTH=15 -HEIGHT=15 +WIDTH=4 +HEIGHT=4 ENTRY=1,1 -EXIT=15,10 -OUTPUT_FILE=con -PERFECT=True +EXIT=1,2 +OUTPUT_FILE=con.txt +PERFECT=False GENERATOR=Kruskal SOLVER=AStar diff --git a/src/AMazeIng.py b/src/AMazeIng.py index 0a1206c..edcd009 100644 --- a/src/AMazeIng.py +++ b/src/AMazeIng.py @@ -66,6 +66,10 @@ class AMazeIng(BaseModel): """ return self.solver.solve(self.maze, self.height, self.width) + def export_maze(self) -> None: + with open(self.output_file, "w") as file: + file.write(self.__str__()) + def __str__(self) -> str: """Return a string representation of the maze and its solution.