# Поиск выхода из лабиринта --- ## Цель работы Разработать гибкую, расширяемую программу для загрузки лабиринта из файла, поиска пути от старта до выхода с возможностью выбора алгоритма, визуализации процесса и экспериментального сравнения алгоритмов. В ходе работы необходимо применить минимум 3 паттерна проектирования из списка GoF, обосновать их выбор и продемонстрировать преимущества такой архитектуры. --- ## Архитектура ```mermaid classDiagram class Maze { -Cell[] cells -int width, height -Cell start -Cell exit +getCell(x,y): Cell +getNeighbors(cell): List~Cell~ } class Cell { -int x, y -bool isWall -bool isStart -bool isExit +isPassable(): bool } class MazeBuilder { <> +buildFromFile(filename): Maze } class TextFileMazeBuilder { +buildFromFile(filename): Maze } class PathFindingStrategy { <> +findPath(maze, start, exit): List~Cell~ } class BFSStrategy class DFSStrategy class AStarStrategy class DijkstraStrategy class SearchStats { +timeMs: float +visitedCells: int +pathLength: int } class MazeSolver { -Maze maze -PathFindingStrategy strategy +setStrategy(strategy) +solve(): SearchStats } class Command { <> +execute() +undo() } class MoveCommand { -Player player -Direction dir -Cell previousCell +execute() +undo() } class Player { -Cell currentCell +moveTo(cell) } class Observer { <> +update(event) } class ConsoleView { +update(event) +render(maze, player, path) } MazeBuilder <|.. TextFileMazeBuilder MazeBuilder --> Maze : creates PathFindingStrategy <|.. BFSStrategy PathFindingStrategy <|.. DFSStrategy PathFindingStrategy <|.. AStarStrategy PathFindingStrategy <|.. DijkstraStrategy MazeSolver --> PathFindingStrategy : uses MazeSolver --> Maze : uses Command <|.. MoveCommand MoveCommand --> Player Player --> Cell Observer <|.. ConsoleView MazeSolver --> Observer : notifies ```