34 lines
993 B
Python
34 lines
993 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},"
|
|
f"{self.strategy},"
|
|
f"{self.duration:.3f},"
|
|
f"{self.visited_cells},"
|
|
f"{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"
|
|
) |