# 4n70n1u5/pathfindingcomparison architecture

> Architecture diagram of the GitHub repository 4n70n1u5/pathfindingcomparison, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/4n70n1u5/pathfindingcomparison
- Repository: https://github.com/4n70n1u5/pathfindingcomparison

## Overview

##### Project type and purpose
- This is a C++ desktop visualization application for comparing pathfinding algorithms on generated mazes.
- It comprises modules for maze generation, pathfinding, UI controls (buttons), and real‐time visualization.

##### File structure
- Top level:
- fonts/ – contains font assets used by the UI
- project/include/ – public headers (interfaces) for each module
- project/src/ – implementation of those modules
- project/main.cpp – entry point and application loop
- Modules:
- Button (UI control)
- Maze (data model for the grid)
- MazeGenerator (builds the maze layout)
- MazeSolver (executes a pathfinding algorithm)
- SolveVisualizer (renders maze and solution steps)

##### README
- Confirms it’s an academic bachelor’s‐degree project for comparing pathfinding approaches.

##### Main components and their interactions
a. Components:
1. Application Core (main.cpp / Event Loop)
2. UI Subsystem
– Button module (handles user input to start/stop operations)
– SolveVisualizer (renders grid, maze walls, and solution steps)
– Font Manager (loads fonts from fonts/ directory)
3. Maze Subsystem
– Maze (data structure representing cells & walls)
– MazeGenerator (creates a randomized maze in the Maze object)
4. Solver Subsystem
– MazeSolver (runs BFS/DFS/A* or other algorithms against the Maze)
b. Relationships & data flow:
– Application Core instantiates and initializes all modules.
– Button presses → invoke MazeGenerator or MazeSolver.
– MazeGenerator updates the Maze model.
– MazeSolver reads Maze, computes a path, updates internal state.
– SolveVisualizer queries both Maze and MazeSolver over time to render each frame.
– Font Manager provides glyphs to SolveVisualizer and Button.
c. Architectural patterns:
– Single Responsibility: each module handles exactly one concern (UI, generation, solving, rendering).
– MVC‐like separation:
- Model = Maze
- View = SolveVisualizer, Button
- Controller = Application Core
d. Key technologies:
– C++17 (or later)
– A graphics/UI library (e.g., SFML, SDL)—implicitly used for rendering and input handling
– Custom modules (listed above)

##### Detail
- Initialization and shutdown flows in the core.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Core
    ApplicationCore["Application Core\n(main loop)"]:::core

    %% UI Layer
    subgraph "UI Subsystem"
        direction TB
        Button["Button"]:::ui
        SolveVisualizer["SolveVisualizer"]:::ui
        FontManager["Font Manager"]:::asset
    end

    %% Algorithm & Model Layer
    subgraph "Algorithm & Model Subsystem"
        direction TB
        MazeGenerator["MazeGenerator"]:::algo
        MazeSolver["MazeSolver"]:::algo
        Maze[(Maze)]:::model
    end

    %% Connections
    Button -->|"onClick"| ApplicationCore
    ApplicationCore -->|"generateMaze()"| MazeGenerator
    ApplicationCore -->|"solve()"| MazeSolver
    MazeGenerator -->|"update Maze"| Maze
    MazeSolver -->|"read Maze"| Maze
    SolveVisualizer -->|"query Maze"| Maze
    SolveVisualizer -->|"query state"| MazeSolver
    FontManager -->|"loadGlyph()"| Button
    FontManager -->|"loadGlyph()"| SolveVisualizer

    %% Click Events
    click ApplicationCore "https://github.com/4n70n1u5/pathfindingcomparison/blob/main/project/main.cpp"
    click Button "https://github.com/4n70n1u5/pathfindingcomparison/blob/main/project/include/Button.hpp"
    click SolveVisualizer "https://github.com/4n70n1u5/pathfindingcomparison/blob/main/project/include/SolveVisualizer.hpp"
    click FontManager "https://github.com/4n70n1u5/pathfindingcomparison/tree/main/fonts/"
    click Maze "https://github.com/4n70n1u5/pathfindingcomparison/blob/main/project/include/Maze.hpp"
    click MazeGenerator "https://github.com/4n70n1u5/pathfindingcomparison/blob/main/project/include/MazeGenerator.hpp"
    click MazeSolver "https://github.com/4n70n1u5/pathfindingcomparison/blob/main/project/include/MazeSolver.hpp"

    %% Styles
    classDef ui fill:#add8e6,stroke:#000,stroke-width:1px
    classDef model fill:#90ee90,stroke:#000,stroke-width:1px
    classDef algo fill:#ffa500,stroke:#000,stroke-width:1px
    classDef core fill:#d3d3d3,stroke:#000,stroke-width:1px
    classDef asset fill:#cccccc,stroke:#000,stroke-width:1px
```
