# dev-du-bled/games-sae1 architecture

> Architecture diagram of the GitHub repository dev-du-bled/games-sae1, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dev-du-bled/games-sae1
- Repository: https://github.com/dev-du-bled/games-sae1

## Overview

##### Main Components

a. Core System Components:
- Main Menu System (menu.cpp)
- Game Launcher (main.cpp)
- Utility Library (libs/utils)
- Terminal Kit Library (libs/termkit)

b. Game Modules:
- Connect4
- Gravier Carton Couteau (Rock Paper Scissors variant)
- Hangman
- Reflex
- Right Price
- Shipwar
- Tic Tac Toe (with its MVC architecture)

**┌─ User Interface Layer ─────────────────────┐**
- Terminal Interface (TermKit)               │
- Menu System                               │
- Game Management Layer ────────────────────┤
- Game Launcher                             │
- Player Management                         │
- Game Modules Layer ──────────────────────┤
- ┌─────┐ ┌─────┐ ┌─────┐ ┌─────┐ ┌─────┐  │
- Game1│ │Game2│ │Game3│ │Game4│ │Game5│  │
- ┘ └─────┘ └─────┘ └─────┘ └─────┘  │
- Utility Layer ───────────────────────────┤
- Utils Library                             │
- Common Functions                          │
- ┘

**┌─ Model ─────┐    ┌─ Controller ─┐    ┌─ View ──────┐**
- Board.hpp   │◄──►│ Game.hpp     │◄──►│ Terminal UI │
- Player.hpp  │    │ Game Logic   │    │ Display     │
- ┘    └──────────────┘    └────────────┘

##### Integration Points

- How TermKit interfaces with each game for display
- Common utility functions used across games
- Relationship between the main launcher and individual games

##### Additional Elements

- Version information and system requirements
- Platform-specific considerations (Windows Terminal, iTerm2, Linux Terminal)

##### Implementation Notes

- The modular nature of the game system
- How new games can be added to the system
- The common interface pattern used across games
- Platform independence of the core system

Remember to:
- Clear boundaries between different system layers
- Flow of control and data between components
- Error handling and user input validation flows

This structure will provide a clear understanding of how the various components interact while maintaining the flexibility to add new games to the system.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef core fill:#3498db,stroke:#2980b9,color:white
    classDef game fill:#2ecc71,stroke:#27ae60,color:white
    classDef util fill:#f1c40f,stroke:#f39c12,color:black
    classDef external fill:#e74c3c,stroke:#c0392b,color:white

    %% User Interface Layer
    subgraph UI
        Terminal["Terminal Interface"]
        MenuSystem["Menu System"]
    end

    %% Game Management Layer
    subgraph Management
        GameLauncher["Game Launcher"]
        PlayerMgmt["Player Management"]
    end

    %% Game Modules Layer
    subgraph Games
        direction TB
        Connect4["Connect4"]
        GCC["Gravier Carton Couteau"]
        Hangman["Hangman"]
        Reflex["Reflex"]
        RightPrice["Right Price"]
        Shipwar["Shipwar"]
        
        subgraph TicTacToe["Tic Tac Toe MVC"]
            direction TB
            TTTModel["Model"]
            TTTController["Controller"]
            TTTView["View"]
            
            TTTModel --- TTTController
            TTTController --- TTTView
        end
    end

    %% Utility Layer
    subgraph Utils
        UtilsLib["Utils Library"]
        TermKit["Terminal Kit"]
        CommonFuncs["Common Functions"]
    end

    %% Relationships
    Terminal --> MenuSystem
    MenuSystem --> GameLauncher
    GameLauncher --> Games
    TermKit --> Games
    UtilsLib --> Games
    PlayerMgmt --> Games

    %% Style Applications
    class Terminal,MenuSystem,GameLauncher,PlayerMgmt core
    class Connect4,GCC,Hangman,Reflex,RightPrice,Shipwar,TTTModel,TTTController,TTTView game
    class UtilsLib,TermKit,CommonFuncs util

    %% Click Events
    click MenuSystem "https://github.com/dev-du-bled/games-sae1/blob/main/menu.cpp"
    click GameLauncher "https://github.com/dev-du-bled/games-sae1/blob/main/main.cpp"
    click UtilsLib "https://github.com/dev-du-bled/games-sae1/blob/main/libs/utils.cpp"
    click TermKit "https://github.com/dev-du-bled/games-sae1/tree/main/libs/termkit"
    click Connect4 "https://github.com/dev-du-bled/games-sae1/blob/main/games/connect4/main.cpp"
    click GCC "https://github.com/dev-du-bled/games-sae1/blob/main/games/gcc/main.cpp"
    click Hangman "https://github.com/dev-du-bled/games-sae1/blob/main/games/hanged/main.cpp"
    click Reflex "https://github.com/dev-du-bled/games-sae1/blob/main/games/reflex/main.cpp"
    click RightPrice "https://github.com/dev-du-bled/games-sae1/blob/main/games/right price/main.cpp"
    click Shipwar "https://github.com/dev-du-bled/games-sae1/blob/main/games/shipwar/main.cpp"
    click TTTModel "https://github.com/dev-du-bled/games-sae1/blob/main/games/tictactoe/board/board.hpp"
    click TTTController "https://github.com/dev-du-bled/games-sae1/blob/main/games/tictactoe/game/game.hpp"
    click TTTView "https://github.com/dev-du-bled/games-sae1/blob/main/games/tictactoe/main.cpp"
```
