# fdp-01-2025/project-real-c-pluh-pluh architecture

> Architecture diagram of the GitHub repository fdp-01-2025/project-real-c-pluh-pluh, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fdp-01-2025/project-real-c-pluh-pluh
- Repository: https://github.com/fdp-01-2025/project-real-c-pluh-pluh

## Overview

##### Project Type and Purpose
- This is a standalone C++ console game (“Pokemon game”) following a layered architecture.
- The “controllers” directory implements the presentation and application workflows (user input, game mode selection, match flow).
- The “src” directory contains the core game engine (domain logic, entities, enums).
- Utilities live under “utils” (printing, base routines).
- Resources (e.g., PokemonNames.txt) are simple data files loaded at runtime.

##### Major Components
a. Presentation/Application Layer (controllers + main.cpp)
- main.cpp – entry point; initializes the game, parses arguments.
- controllers/… – orchestrates game flow: loader, game modes, match controllers, entity controllers (createMatch, selectPokemon, attack).
b. Domain Layer (src/game + src/enums)
- Entities: matchControllers, selectPokemon, attack, singlePlayerMode, etc.
- Enums: game modes, attack types, Pokemon types.
- Interfaces: loader.h, game.h define abstractions for loading data and running the game loop.
c. Infrastructure Layer (utils)
- base.cpp/.h – common utilities.
- printCentered.cpp/.h – console formatting helpers.
d. Data Layer
- PokemonNames.txt – external resource loaded by loader.
e. Build/Deployment
- compile.txt – build instructions; result is pokemonGame.exe.
- .vscode folder – IDE settings (launch, tasks).

##### Relationships and Data Flow
- User invokes pokemonGame.exe → main.cpp initializes Controller.
- Controller calls Loader → reads PokemonNames.txt into in-memory structs.
- Controller selects mode (single vs. test) → instantiates appropriate mode controllers.
- Controllers invoke Domain APIs (src/game/*.h) to mutate game state, resolve attacks, update matches.
- Domain logic uses Enums and Structs (src/enums, src/game/entities/structs).
- Throughout execution, Utility layer is called to print UI to console.

##### Architectural Patterns and Design Principles
- Layered architecture (Presentation → Application → Domain → Infrastructure).
- Separation of concerns: “controllers” handle workflows, “src” handles pure logic, “utils” for cross‐cutting concerns.
- File‐based configuration/resource loading (single resource file for Pokemon names).

##### Detailed Component Breakdown (to include
- Presentation/Application: main.cpp, controllers/loader.cpp, selectGameMode.cpp, game.cpp, singleMode/*, entities/match/*, entities/pokemon/*.
- Domain: src/game/game.h, src/game/selectGameMode.h, src/game/singleMode/*.
- Enums/Data Structures: src/enums/*.h, src/game/entities/structs.h.
- Utilities: utils/base.h, utils/printCentered.h.
- Resource: controllers/entities/pokemon/PokemonNames.txt.
- Build: compile.txt → pokemonGame.exe.

## Diagram (Mermaid)

```mermaid
flowchart TD
    U["User / CLI"]:::external

    subgraph "Presentation/Application Layer"
        direction TB
        main["main.cpp"]:::presentation
        controllersDir["controllers/"]:::presentation
        loader["loader.cpp"]:::presentation
        gameCtrl["game.cpp"]:::presentation
        selectModeCtrl["selectGameMode.cpp"]:::presentation
        attackCtrl["attack.cpp"]:::presentation
        testCtrl["testingMatch.cpp"]:::presentation
        singlePlayerCtrl["singlePlayerMode.cpp"]:::presentation
        showMapCtrl["showMap.cpp"]:::presentation
        createMatchCtrl["createMatch.cpp"]:::presentation
        matchCtrl["matchControllers.cpp"]:::presentation
        selectPokemonCtrl["SelectPokemon.cpp"]:::presentation
        setDataCtrl["setData.cpp"]:::presentation
    end

    subgraph "Domain Layer"
        direction TB
        domainDir["src/game/"]:::domain
        gameH["game.h"]:::domain
        loaderH["loader.h"]:::domain
        selectModeH["selectGameMode.h"]:::domain
        testMatchH["testMatch.h"]:::domain
        enumsDir["src/enums/"]:::domain
        gameModesH["gameModes.h"]:::domain
        attacksH["pokemonAttacks.h"]:::domain
        typesH["pokemonTypes.h"]:::domain
        structsH["structs.h"]:::domain
        createMatchH["createMatch.h"]:::domain
        matchCtrlH["matchControllers.h"]:::domain
        attackH["attack.h"]:::domain
        selectPokemonH["selectPokemon.h"]:::domain
        setDataH["setData.h"]:::domain
        spModeH["singlePlayerMode.h"]:::domain
        showMapH["showMap.h"]:::domain
    end

    subgraph "Infrastructure Layer"
        direction TB
        baseH["base.h"]:::infra
        baseCPP["base.cpp"]:::infra
        printH["printCentered.h"]:::infra
        printCPP["printCentered.cpp"]:::infra
    end

    data["PokemonNames.txt"]:::data

    subgraph "Build/Deployment"
        direction TB
        compile["compile.txt"]:::build
        exe["pokemonGame.exe"]:::build
        vscode[".vscode/"]:::build
    end

    U -->|"invoke"| main
    main -->|"initialize"| loader
    main -->|"startMode"| selectModeCtrl
    loader -->|"loadPokemonNames()"| data
    selectModeCtrl -->|"selectGameMode()"| selectModeH
    loader -->|"loadData()"| loaderH
    attackCtrl -->|"executeAttack()"| attackH
    selectPokemonCtrl -->|"choosePokemon()"| selectPokemonH
    createMatchCtrl -->|"createMatch()"| createMatchH
    matchCtrl -->|"updateMatch()"| matchCtrlH
    spModeH -->|"runSingleMode()"| singlePlayerCtrl
    showMapH -->|"displayMap()"| showMapCtrl
    domainDir --> gameH
    enumsDir --> gameModesH
    structsH --> domainDir
    baseCPP -->|"utilCall"| baseH
    printCPP -->|"printCentered()"| printH
    domainDir --> baseH
    domainDir --> printH
    compile -.->|"build"| exe

    click main "https://github.com/fdp-01-2025/project-real-c-pluh-pluh/blob/main/main.cpp"
    click loader "https://github.com/fdp-01-2025/project-real-c-pluh-pluh/blob/main/controllers/loader.cpp"
    click gameCtrl "https://github.com/fdp-01-2025/project-real-c-pluh-pluh/blob/main/controllers/game.cpp"
    click selectModeCtrl "https://github.com/fdp-01-2025/project-real-c-pluh-pluh/blob/main/controllers/selectGameMode.cpp"
    click attackCtrl "https://github.com/fdp-01-2025/project-real-c-pluh-pluh/blob/main/controllers/attack.cpp"
    click testCtrl "https://github.com/fdp-01-2025/project-real-c-pluh-pluh/blob/main/controllers/testingMatch.cpp"
    click singlePlayerCtrl "https://github.com/fdp-01-2025/project-real-c-pluh-pluh/blob/main/controllers/singleMode/singlePlayerMode.cpp"
    click showMapCtrl "https://github.com/fdp-01-2025/project-real-c-pluh-pluh/blob/main/controllers/singleMode/showMap.cpp"
    click createMatchCtrl "https://github.com/fdp-01-2025/project-real-c-pluh-pluh/blob/main/controllers/entities/match/createMatch.cpp"
    click matchCtrl "https://github.com/fdp-01-2025/project-real-c-pluh-pluh/blob/main/controllers/entities/match/matchControllers.cpp"
    click selectPokemonCtrl "https://github.com/fdp-01-2025/project-real-c-pluh-pluh/blob/main/controllers/entities/pokemon/SelectPokemon.cpp"
    click setDataCtrl "https://github.com/fdp-01-2025/project-real-c-pluh-pluh/blob/main/controllers/entities/pokemon/setData.cpp"
    click gameH "https://github.com/fdp-01-2025/project-real-c-pluh-pluh/blob/main/src/game/game.h"
    click loaderH "https://github.com/fdp-01-2025/project-real-c-pluh-pluh/blob/main/src/game/loader.h"
    click selectModeH "https://github.com/fdp-01-2025/project-real-c-pluh-pluh/blob/main/src/game/selectGameMode.h"
    click testMatchH "https://github.com/fdp-01-2025/project-real-c-pluh-pluh/blob/main/src/game/testMatch.h"
    click gameModesH "https://github.com/fdp-01-2025/project-real-c-pluh-pluh/blob/main/src/enums/gameModes.h"
    click attacksH "https://github.com/fdp-01-2025/project-real-c-pluh-pluh/blob/main/src/enums/pokemonAttacks.h"
    click typesH "https://github.com/fdp-01-2025/project-real-c-pluh-pluh/blob/main/src/enums/pokemonTypes.h"
    click createMatchH "https://github.com/fdp-01-2025/project-real-c-pluh-pluh/blob/main/src/game/entities/match/createMatch.h"
    click matchCtrlH "https://github.com/fdp-01-2025/project-real-c-pluh-pluh/blob/main/src/game/entities/match/matchControllers.h"
    click attackH "https://github.com/fdp-01-2025/project-real-c-pluh-pluh/blob/main/src/game/entities/pokemon/attack.h"
    click selectPokemonH "https://github.com/fdp-01-2025/project-real-c-pluh-pluh/blob/main/src/game/entities/pokemon/selectPokemon.h"
    click setDataH "https://github.com/fdp-01-2025/project-real-c-pluh-pluh/blob/main/src/game/entities/pokemon/setData.h"
    click structsH "https://github.com/fdp-01-2025/project-real-c-pluh-pluh/blob/main/src/game/entities/structs.h"
    click spModeH "https://github.com/fdp-01-2025/project-real-c-pluh-pluh/blob/main/src/game/singleMode/singlePlayerMode.h"
    click showMapH "https://github.com/fdp-01-2025/project-real-c-pluh-pluh/blob/main/src/game/singleMode/showMap.h"
    click baseH "https://github.com/fdp-01-2025/project-real-c-pluh-pluh/blob/main/utils/base.h"
    click baseCPP "https://github.com/fdp-01-2025/project-real-c-pluh-pluh/blob/main/utils/base.cpp"
    click printH "https://github.com/fdp-01-2025/project-real-c-pluh-pluh/blob/main/utils/printCentered.h"
    click printCPP "https://github.com/fdp-01-2025/project-real-c-pluh-pluh/blob/main/utils/printCentered.cpp"
    click compile "https://github.com/fdp-01-2025/project-real-c-pluh-pluh/blob/main/compile.txt"
    click vscode "https://github.com/fdp-01-2025/project-real-c-pluh-pluh/tree/main/.vscode/"

    classDef presentation fill:#ADD8E6,stroke:#000;
    classDef domain fill:#90EE90,stroke:#000;
    classDef infra fill:#FFD580,stroke:#000;
    classDef data fill:#D3D3D3,stroke:#000,shape:cylinder;
    classDef build fill:#FFFACD,stroke:#000,shape:parallelogram;
    classDef external fill:#EEEEEE,stroke:#000;
```
