# dam-dad/bingomandingo architecture

> Architecture diagram of the GitHub repository dam-dad/bingomandingo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dam-dad/bingomandingo
- Repository: https://github.com/dam-dad/bingomandingo

## Overview

##### Project Type and Purpose
- This project is a Java-based desktop application – a full-fledged Bingo game for family settings.
- The README emphasizes a family-friendly bingo game with features like player configuration, printer integration for bingo cards, and interactive game panels (e.g., ball drawing, checking for line/bingo).
- It leverages JavaFX (with corresponding FXML files for views) for the user interface and uses Maven (as evidenced by pom.xml) to manage dependencies/build processes.

##### Analysis of the File Structure
- Java Source Files (src/main/java):
- Core application entry points (App.java, Main.java, MetodosImpresion.java) form the backbone.
- The “controllers” package contains various controllers such as GameController, MainMenuController, and RootController which mediate between the UI and game logic.
- A “Models” subpackage under controllers houses classes like BingoGenerator, Carton, and Player that encapsulate the domain logic.
- Resources (src/main/resources):
- FXML files define the user interface layouts for various views (GameView, MainMenuView, RootView, ScoreboardView, and AddPlayers).
- CSS and image directories provide styling and assets for the GUI.
- Other assets like PDFs and Excel files for bingo tables suggest support documentation or game setup data.
- Build and configuration files:
- The pom.xml file indicates the Maven build system.
- MANIFEST.MF defines application metadata.

##### Main Components & Their Interactions
- User Interface Layer:
- JavaFX Views defined by FXML files: MainMenuView, GameView, AddPlayers, etc.
- Styling and resources for the UI (styles.css and images).
- Controller Layer:
- Controllers (GameController, MainMenuController, RootController) handle user interactions and pass data between the UI and business logic.
- They coordinate game flow: starting the game, handling input from user actions (e.g., “Siguiente Numero”, “Comprobar Línea”, “Comprobar Bingo”).
- Domain/Model Layer:
- Classes representing the business logic (BingoGenerator, Carton, Player) manage core functionalities such as generating bingo cards and validating bingo results.
- Utility/Service Layer:
- Methods for printing (MetodosImpresion.java) that, coupled with printer configuration, manage the physical printing of bingo cards.
- Build & Deployment:
- Managed via Maven (pom.xml) with outputs generated in the “out/artifacts” folder (packaged as BingoMandingo.jar).

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Application Entry Points
    subgraph "Application Entry Points"
        A1("App"):::entry
        A2("Main"):::entry
    end

    %% UI Layer
    subgraph "User Interface Layer"
        U1("Main Menu View"):::ui
        U2("Game View"):::ui
        U3("Root View"):::ui
        U4("Scoreboard View"):::ui
        U5("Add Players View"):::ui
    end

    %% Controller Layer
    subgraph "Controller Layer"
        C1("MainMenuController"):::controller
        C2("GameController"):::controller
        C3("RootController"):::controller
    end

    %% Domain/Model Layer
    subgraph "Domain/Model Layer"
        D1("BingoGenerator"):::model
        D2("Carton"):::model
        D3("Player"):::model
    end

    %% Utility/Service Layer
    subgraph "Utility/Service Layer"
        ULT("MetodosImpresion"):::utility
    end

    %% Build & Deployment
    subgraph "Build & Deployment"
        B1("Maven Build File"):::build
        B2("Packaged Artifact"):::build
    end

    %% External Hardware
    EXT("Printer Hardware"):::external

    %% Connections: Application Entry Points to Controllers
    A1 -->|"starts"| C1
    A1 -->|"starts"| C2
    A1 -->|"starts"| C3
    A2 -->|"launches"| A1

    %% Connections: UI Layer to Controllers
    U1 -->|"triggers"| C1
    U2 -->|"triggers"| C2
    U3 -->|"triggers"| C3
    U4 -->|"updates"| C3
    U5 -->|"configures"| C1

    %% Connections: Controllers to Domain/Model Layer
    C1 -->|"configures"| D3
    C2 -->|"generates"| D1
    C2 -->|"manages"| D2
    C2 -->|"updates"| D3

    %% Connections: Controllers to Utility/Service Layer
    C1 -->|"printrequest"| ULT
    C2 -->|"printrequest"| ULT

    %% Connections: Utility to External Printer
    ULT -->|"prints"| EXT

    %% Connections: Build & Deployment Flow
    B1 -->|"builds"| B2

    %% Class Definitions for Colors
    classDef ui fill:#AED6F1,stroke:#1F618D,stroke-width:2px;
    classDef controller fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef model fill:#A9DFBF,stroke:#27AE60,stroke-width:2px;
    classDef utility fill:#F5CBA7,stroke:#D35400,stroke-width:2px;
    classDef entry fill:#D7BDE2,stroke:#8E44AD,stroke-width:2px;
    classDef build fill:#E6B0AA,stroke:#C0392B,stroke-width:2px;
    classDef external fill:#F0B27A,stroke:#E67E22,stroke-width:2px;

    %% Click Events for UI Layer
    click U1 "https://github.com/dam-dad/bingomandingo/blob/main/src/main/resources/fxml/MainMenuVIew.fxml"
    click U2 "https://github.com/dam-dad/bingomandingo/blob/main/src/main/resources/fxml/GameView.fxml"
    click U3 "https://github.com/dam-dad/bingomandingo/blob/main/src/main/resources/fxml/RootView.fxml"
    click U4 "https://github.com/dam-dad/bingomandingo/blob/main/src/main/resources/fxml/ScoreboardView.fxml"
    click U5 "https://github.com/dam-dad/bingomandingo/blob/main/src/main/resources/fxml/Players/AddPlayers.fxml"

    %% Click Events for Controllers
    click C1 "https://github.com/dam-dad/bingomandingo/blob/main/src/main/java/es/controllers/MainMenuController.java"
    click C2 "https://github.com/dam-dad/bingomandingo/blob/main/src/main/java/es/controllers/GameController.java"
    click C3 "https://github.com/dam-dad/bingomandingo/blob/main/src/main/java/es/controllers/RootController.java"

    %% Click Events for Domain/Model Layer
    click D1 "https://github.com/dam-dad/bingomandingo/blob/main/src/main/java/es/controllers/Models/BingoGenerator.java"
    click D2 "https://github.com/dam-dad/bingomandingo/blob/main/src/main/java/es/controllers/Models/Carton.java"
    click D3 "https://github.com/dam-dad/bingomandingo/blob/main/src/main/java/es/controllers/Models/Player.java"

    %% Click Event for Utility/Service Layer
    click ULT "https://github.com/dam-dad/bingomandingo/blob/main/src/main/java/es/MetodosImpresion.java"

    %% Click Events for Application Entry Points
    click A1 "https://github.com/dam-dad/bingomandingo/blob/main/src/main/java/es/App.java"
    click A2 "https://github.com/dam-dad/bingomandingo/blob/main/src/main/java/es/Main.java"

    %% Click Events for Build & Deployment
    click B1 "https://github.com/dam-dad/bingomandingo/blob/main/pom.xml"
    click B2 "https://github.com/dam-dad/bingomandingo/blob/main/out/artifacts/BingoMandingo_jar/BingoMandingo.jar"
```
