# paul-rezzonico/latice architecture

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

- Interactive diagram: https://gitdiagram.com/paul-rezzonico/latice
- Repository: https://github.com/paul-rezzonico/latice

## Overview

##### Project Type and Purpose
- Latice is a full-fledged board game application built on Java, leveraging JavaFX for the GUI and a robust Java-based architecture. It combines interactive game logic, a clear model-view-controller (MVC) structure for the interface, and resource management (images and music).

##### File Structure
- Top-Level Organization:
- The project uses Maven (pom.xml) for build management.
- Source code is organized under “src/main/java/latice” with clear separation into subdirectories: “application” for core game logic, “ihm” (which includes “controller” and “view”) for the GUI/controllers, and “model” for representing data (like Player, Board, and Tile classes).
- Resources such as images, music, and tile assets are available in “src/main/resources”.
- There is also a test directory for unit testing using JUnit.

- Architectural Implications:
- The project is following a MVC-inspired design: Controllers in “latice/ihm/controller”, Views in “latice/ihm/view”, and core logic/model classes in “latice/application” and “latice/model”.
- The structure also suggests that the controllers mediate between the view (GUI components) and the underlying game logic.

##### README
- The README clearly explains key components:
- Game Logic: where rules and mechanics (Game.java) are implemented.
- GUI: implemented using JavaFX (BoardFX, MenuFX, PlayFX, etc.).
- Controllers: handling specific functionalities (DnDController, ParametersController, etc.).
- Model: representing players, board elements, and tiles.
- It also mentions external resources (images and music) and technologies like Maven, JUnit, and Git.

a. Main Components:
- User Interface (JavaFX-driven GUI): Including various view classes like MenuFX, BoardFX, PlayFX.
- Controllers: Handling user events and mediating between the view and the game logic. Key classes include DnDController, ParametersController, etc.
- Game Logic: Core functionality and game rules implemented in the Game.java file.
- Model: Data representation for players, boards, tiles, etc.
- Resources: External assets such as images, music files, and other media.
- Build and Test Infrastructure: Indicating Maven configuration (pom.xml) and test suites managed by JUnit.

b. Relationships/Interactions:
- UI Components (Views) interact with Controllers to capture user actions.
- Controllers invoke methods on the Game Logic component, which, in turn, interacts with Model classes to update game state.
- The Model provides data to both the Game Logic (for computing game rules) and the UI (to display the current game state).
- Resources are loaded at runtime by appropriate components (like views load images or music).
- Test components verify functionality across the game logic and model implementations.

c. Architectural Patterns and Design Principles:
- MVC/MVP Pattern: The separation among model, controllers, and views.
- Layered Architecture: UI, Controller layer, Business Logic, and Data Model layers.
- Dependency management and building via Maven is implied.

d. Relevant Technologies:
- Java (Java 8) for the application’s core and game logic.
- JavaFX for the GUI.
- Maven for build and dependency management.
- JUnit for testing.
- Git for version control.

##### Detail
- Detail as many components as possible from the provided file tree: highlight individual controllers, their responsibilities, and the view components that get bridged with them.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "User Interface (JavaFX Views)"
        UI1["MenuFX"]:::ui
        UI2["BoardFX"]:::ui
        UI3["PlayFX"]:::ui
        UI4["RackFX"]:::ui
        UI5["Parameters"]:::ui
    end

    subgraph "Controllers"
        C1["ChangeRackController"]:::controller
        C2["DnDController"]:::controller
        C3["EndTurnController"]:::controller
        C4["ExitController"]:::controller
        C5["ObjectionController"]:::controller
        C6["ParametersController"]:::controller
        C7["PlayController"]:::controller
        C8["ReturnController"]:::controller
    end

    subgraph "Game Logic"
        G1["Game"]:::logic
    end

    subgraph "Model"
        M1["Player"]:::model
        subgraph "Board Component"
            M2["Board"]:::model
            M3["Box"]:::model
            M4["Shape"]:::model
        end
        subgraph "Tile Component"
            M5["Tile"]:::model
            M6["Color"]:::model
            M7["Position"]:::model
            M8["Symbol"]:::model
        end
    end

    subgraph "Resources"
        R1["Resources"]:::resources
    end

    subgraph "Testing Infrastructure"
        T1["TestForBoard"]:::test
        T2["TestForPlayer"]:::test
    end

    subgraph "Build & Dependency Management"
        B1["pom.xml"]:::build
    end

    %% Connections
    UI2 -->|"event-triggers"| C2
    C7 -->|"invoke-game-rules"| G1
    G1 -->|"update-state"| M2
    M1 -->|"display-state"| UI5
    UI2 -->|"loads-resource"| R1
    T1 -->|"validates"| M2
    T2 -->|"validates"| M1
    B1 -->|"builds"| G1
    B1 -->|"builds"| M1

    %% Click Events for User Interface
    click UI1 "https://github.com/paul-rezzonico/latice/blob/main/src/main/java/latice/ihm/view/MenuFX.java"
    click UI2 "https://github.com/paul-rezzonico/latice/blob/main/src/main/java/latice/ihm/view/BoardFX.java"
    click UI3 "https://github.com/paul-rezzonico/latice/blob/main/src/main/java/latice/ihm/view/PlayFX.java"
    click UI4 "https://github.com/paul-rezzonico/latice/blob/main/src/main/java/latice/ihm/view/RackFX.java"
    click UI5 "https://github.com/paul-rezzonico/latice/blob/main/src/main/java/latice/ihm/view/Parameters.java"

    %% Click Events for Controllers
    click C1 "https://github.com/paul-rezzonico/latice/blob/main/src/main/java/latice/ihm/controller/ChangeRackController.java"
    click C2 "https://github.com/paul-rezzonico/latice/blob/main/src/main/java/latice/ihm/controller/DnDController.java"
    click C3 "https://github.com/paul-rezzonico/latice/blob/main/src/main/java/latice/ihm/controller/EndTurnController.java"
    click C4 "https://github.com/paul-rezzonico/latice/blob/main/src/main/java/latice/ihm/controller/ExitController.java"
    click C5 "https://github.com/paul-rezzonico/latice/blob/main/src/main/java/latice/ihm/controller/ObjectionController.java"
    click C6 "https://github.com/paul-rezzonico/latice/blob/main/src/main/java/latice/ihm/controller/ParametersController.java"
    click C7 "https://github.com/paul-rezzonico/latice/blob/main/src/main/java/latice/ihm/controller/PlayController.java"
    click C8 "https://github.com/paul-rezzonico/latice/blob/main/src/main/java/latice/ihm/controller/ReturnController.java"

    %% Click Event for Game Logic
    click G1 "https://github.com/paul-rezzonico/latice/blob/main/src/main/java/latice/application/Game.java"

    %% Click Events for Model
    click M1 "https://github.com/paul-rezzonico/latice/blob/main/src/main/java/latice/model/Player.java"
    click M2 "https://github.com/paul-rezzonico/latice/blob/main/src/main/java/latice/model/board/Board.java"
    click M3 "https://github.com/paul-rezzonico/latice/blob/main/src/main/java/latice/model/board/Box.java"
    click M4 "https://github.com/paul-rezzonico/latice/blob/main/src/main/java/latice/model/board/Shape.java"
    click M5 "https://github.com/paul-rezzonico/latice/blob/main/src/main/java/latice/model/tile/Tile.java"
    click M6 "https://github.com/paul-rezzonico/latice/blob/main/src/main/java/latice/model/tile/Color.java"
    click M7 "https://github.com/paul-rezzonico/latice/blob/main/src/main/java/latice/model/tile/Position.java"
    click M8 "https://github.com/paul-rezzonico/latice/blob/main/src/main/java/latice/model/tile/Symbol.java"

    %% Click Event for Resources
    click R1 "https://github.com/paul-rezzonico/latice/tree/main/src/main/resources"

    %% Click Events for Testing Infrastructure
    click T1 "https://github.com/paul-rezzonico/latice/blob/main/src/test/java/latice/TestForBoard.java"
    click T2 "https://github.com/paul-rezzonico/latice/blob/main/src/test/java/latice/TestForPlayer.java"

    %% Click Event for Build & Dependency Management
    click B1 "https://github.com/paul-rezzonico/latice/blob/main/pom.xml"

    %% Styles
    classDef ui fill:#C6E2FF,stroke:#034694,stroke-width:2px;
    classDef controller fill:#FFCC99,stroke:#FF7F50,stroke-width:2px;
    classDef logic fill:#D1E8E2,stroke:#2E8B57,stroke-width:2px;
    classDef model fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef resources fill:#E8DAEF,stroke:#8E44AD,stroke-width:2px;
    classDef test fill:#FADBD8,stroke:#E74C3C,stroke-width:2px;
    classDef build fill:#D5F5E3,stroke:#27AE60,stroke-width:2px;
```
