2026-rff_mp/pomelovsd/ExitMaze/MazeSolver/Solver.py

20 lines
499 B
Python
Raw Normal View History

2026-05-23 10:37:43 +00:00
from .SearchStats import SearchStats
2026-05-22 20:58:06 +00:00
import time
class MazeSolver:
def __init__(self, maze, strategy):
self.maze = maze
self.strategy = strategy
def setStrategy(self, strategy):
self.strategy = strategy
def solve(self):
start = time.perf_counter()
path, visited = self.strategy.findPath(self.maze, self.maze.start, self.maze.exit)
end = time.perf_counter()
return SearchStats((end-start)*1000, visited, len(path)), path