from .SearchStats import SearchStats
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