21 lines
818 B
Python
21 lines
818 B
Python
class SearchStats:
|
|
def __init__(self, strategy, maze_name, duration, visited_cells, path_length):
|
|
self.strategy = strategy
|
|
self.maze_name = maze_name
|
|
self.duration = duration
|
|
self.visited_cells = visited_cells
|
|
self.path_length = path_length
|
|
|
|
def to_csv_row(self):
|
|
return f"{self.maze_name},{self.strategy},{self.duration:.3f},{self.visited_cells},{self.path_length}\n"
|
|
|
|
def __str__(self):
|
|
return (
|
|
f"\n=== SEARCH RESULT ===\n"
|
|
f"Strategy : {self.strategy}\n"
|
|
f"Maze : {self.maze_name}\n"
|
|
f"Time (ms) : {self.duration:.3f}\n"
|
|
f"Visited cells : {self.visited_cells}\n"
|
|
f"Path length : {self.path_length}\n"
|
|
f"=====================\n"
|
|
) |