from abc import ABC, abstractmethod


class PathFindingStrategy(ABC):
    name = "Base"

    def __init__(self):
        self.visitedCount = 0

    @abstractmethod
    def findPath(self, maze, start, exitCell):
        raise NotImplementedError

    def _restore_path(self, parent, start, exitCell):
        if exitCell is None or start is None:
            return []

        path = []
        current = exitCell

        while True:
            path.append(current)
            if current.x == start.x and current.y == start.y:
                break
            current = parent.get((current.x, current.y))
            if current is None:
                return []

        path.reverse()
        return path
