# morilhat-paul/mines architecture

> Architecture diagram of the GitHub repository morilhat-paul/mines, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/morilhat-paul/mines
- Repository: https://github.com/morilhat-paul/mines

## Overview

##### Project type and purpose
- This is a desktop game (Minesweeper clone) written in C++ using the SFML graphics library.
- Key indicators: C++ source files under src/, dependencies on SFML and fmt under dependencies/, assets folder for images, a Main.cpp that kicks off the game loop.

##### File structure
- Top-level:
- CMakeLists.txt & build.sh – build scripts and configuration
- dependencies/ – vendored libraries (fmt for formatting, sfml for windowing/rendering)
- assets/ – game images and other media
- public/ – logo or read-only assets
- src/ – all game source, organized into subdirectories by domain:
– Constant: game constants (e.g., board dimensions, tile sizes)
– Textures: resource loader/unloader for SFML textures
– MineCell: individual cell logic/state
– MineField: grid of MineCell, board generation, neighbor calculation
– Game: application logic, input handling, game state transitions (start, win, lose)
– Main.cpp: initializes SFML, creates Game instance, runs the main loop

##### README for additional insights
- Confirms it’s a Mines game under active development

a. Main components to represent
- Entry Point (Main)
- Game Controller (Game)
- Data Model (MineField & MineCell)
- Resource Manager (Textures)
- Constants module (Constant)
- Rendering & Windowing (SFML)
- External Libraries (fmt, SFML modules)
- Assets (image files)
b. Relationships and interactions
- Main → instantiates Game, passes SFML RenderWindow
- Game ↔ MineField: game logic invokes methods to reveal cells, place flags
- MineField → MineCell: contains collection of cells, delegates neighbor logic
- Game → Textures: requests sprite resources for rendering cells and UI
- Textures → Assets: loads image files at startup
- fmt → Game / MineField: used for logging or formatting debug output
c. Architectural patterns and principles
- Modular layering: separation of concerns between presentation (SFML) and core logic (MineField/MineCell)
- Resource management: centralized texture loader to avoid redundant loads
- Single responsibility: each folder/class has one clear purpose
d. Relevant technologies & frameworks
- CMake build system invoking dependencies/fmt and dependencies/sfml subprojects
- SFML modules: Window, Graphics, System, Audio
- fmt library for string formatting
- build.sh as an entrypoint for developers to configure & compile

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Entry & Controller"
        Main["Main"]:::entry
        Game["Game Controller"]:::core
    end

    subgraph "Core Logic"
        MineField["MineField"]:::core
        MineCell["MineCell"]:::core
    end

    subgraph "Presentation"
        TextureManager["TextureManager"]:::presentation
        SFMLRender["SFML RenderWindow/EventSystem"]:::presentation
    end

    subgraph "Configuration & Assets"
        Constant["Constant"]:::config
        Assets["Assets Folder"]:::assets
        PublicAssets["Public Assets"]:::assets
    end

    subgraph "External Libraries"
        fmtLib["fmt Library"]:::external
        SFMLLib["SFML Library"]:::external
    end

    subgraph "Build System"
        CMake["CMake Configuration"]:::build
        BuildScript["build.sh"]:::build
    end

    %% Connections
    Main --> Game
    Game --> MineField
    Game --> TextureManager
    Game --> SFMLRender
    MineField --> MineCell
    TextureManager --> Assets
    Constant --> Game
    Constant --> MineField
    fmtLib --> Game
    fmtLib --> MineField
    SFMLLib --> SFMLRender
    CMake --> Main
    CMake --> fmtLib
    CMake --> SFMLLib
    BuildScript --> CMake

    %% Click Events
    click Main "https://github.com/morilhat-paul/mines/blob/main/src/Main.cpp"
    click Game "https://github.com/morilhat-paul/mines/tree/main/src/Game/"
    click MineField "https://github.com/morilhat-paul/mines/tree/main/src/MineField/"
    click MineCell "https://github.com/morilhat-paul/mines/blob/main/src/MineCell/MineCell.hpp"
    click TextureManager "https://github.com/morilhat-paul/mines/tree/main/src/Textures/"
    click Constant "https://github.com/morilhat-paul/mines/blob/main/src/Constant/Constant.hpp"
    click Assets "https://github.com/morilhat-paul/mines/tree/main/assets/"
    click PublicAssets "https://github.com/morilhat-paul/mines/tree/main/public/"
    click fmtLib "https://github.com/morilhat-paul/mines/tree/main/dependencies/fmt/"
    click SFMLLib "https://github.com/morilhat-paul/mines/tree/main/dependencies/sfml/"
    click CMake "https://github.com/morilhat-paul/mines/blob/main/CMakeLists.txt"
    click BuildScript "https://github.com/morilhat-paul/mines/blob/main/build.sh"

    %% Styles
    classDef entry fill:#FFD700,stroke:#333,stroke-width:1px
    classDef core fill:#ADFF2F,stroke:#333,stroke-width:1px
    classDef presentation fill:#87CEFA,stroke:#333,stroke-width:1px
    classDef config fill:#FFA500,stroke:#333,stroke-width:1px
    classDef assets fill:#FFE4B5,stroke:#333,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef build fill:#E6E6FA,stroke:#333,stroke-width:1px
```
