mirror of
https://github.com/maoakeEnterprise/amazing.git
synced 2026-04-28 16:04:35 +02:00
add export file
This commit is contained in:
+1
-2
@@ -486,8 +486,7 @@ def main() -> None:
|
|||||||
config = Parsing.get_data_maze("config.txt")
|
config = Parsing.get_data_maze("config.txt")
|
||||||
amazing = AMazeIng(**config)
|
amazing = AMazeIng(**config)
|
||||||
mlx.start(amazing)
|
mlx.start(amazing)
|
||||||
with open("test.txt", "w") as output:
|
amazing.export_maze()
|
||||||
output.write(amazing.__str__())
|
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
print(err)
|
print(err)
|
||||||
finally:
|
finally:
|
||||||
|
|||||||
+5
-5
@@ -1,8 +1,8 @@
|
|||||||
WIDTH=15
|
WIDTH=4
|
||||||
HEIGHT=15
|
HEIGHT=4
|
||||||
ENTRY=1,1
|
ENTRY=1,1
|
||||||
EXIT=15,10
|
EXIT=1,2
|
||||||
OUTPUT_FILE=con
|
OUTPUT_FILE=con.txt
|
||||||
PERFECT=True
|
PERFECT=False
|
||||||
GENERATOR=Kruskal
|
GENERATOR=Kruskal
|
||||||
SOLVER=AStar
|
SOLVER=AStar
|
||||||
|
|||||||
@@ -66,6 +66,10 @@ class AMazeIng(BaseModel):
|
|||||||
"""
|
"""
|
||||||
return self.solver.solve(self.maze, self.height, self.width)
|
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:
|
def __str__(self) -> str:
|
||||||
"""Return a string representation of the maze and its solution.
|
"""Return a string representation of the maze and its solution.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user