# sabinelenny/projetpirates architecture

> Architecture diagram of the GitHub repository sabinelenny/projetpirates, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sabinelenny/projetpirates
- Repository: https://github.com/sabinelenny/projetpirates

## Overview

1. **Overall shape**
   - This is a small Java/Maven game project centered on a pirate board game.  
   - The code is organized in a clear layered style: **presentation boundaries** → **controllers** → **domain entities**.

2. **Presentation layer**
   - `Boundaries/BoundarieIHM.java` and `Boundaries/BoundariesJeuTextuel.java` define the two user-facing entry points/boundaries.
   - The repository therefore supports at least two interaction modes:
     - a **graphical UI**,
     - a **text-based UI**.

3. **Graphical UI subsystem**
   - The `IHM` package contains Swing-based UI pieces:
     - `frame3.java` and `frame3.form` indicate a GUI form built with a visual designer,
     - `BackgroundPanel.java` is a custom Swing component for display styling.
   - The README’s TODO list confirms the GUI is still evolving: dice animation, pawn design, life bar, special-case animations, and movement visuals.

4. **Controller layer**
   - The `Controleurs` package is the main application logic boundary between UI and model.
   - It contains one controller per gameplay concern:
     - `ControlJeuPirate` likely coordinates the overall game flow,
     - `ControlPlateau` manages the board,
     - `ControlPirate` manages pirate/player state,
     - `ControlDéplacer` handles movement,
     - `ControlLancerDeDes` handles dice rolls,
     - `ControlFinJeu` handles end-of-game detection,
     - `ControlVerifierVie` and `ControlVerifierPoison` handle status checks,
     - `ControlCase*` classes handle special board cases such as bomb, poison, exchange, and healing.

5. **Domain/model layer**
   - The `Entite` package contains the core game state:
     - `Pirate.java` represents a player/pawn,
     - `Plateau.java` represents the game board,
     - `TypeCase.java` likely enumerates or classifies square types.
   - These classes appear to be the stable game model manipulated by the controllers.

6. **Gameplay mechanics implied by the structure**
   - The board game seems to include:
     - movement determined by **dice rolls**,
     - **special squares** with effects,
     - **status effects** like poison and life changes,
     - a **win/end condition**.
   - The separate `ControlCaseBombe`, `ControlCasePoison`, `ControlCaseEchange`, and `ControlCaseSoin` classes suggest each square type has its own behavior path.

7. **Data flow**
   - User actions originate in either the GUI or text interface.
   - Those actions are passed to controllers, which:
     - query/update `Pirate` and `Plateau`,
     - apply square effects,
     - verify poison/life/end conditions,
     - then return updated state for the UI to render or print.
   - The UI itself does not appear to own game rules; it mainly triggers and displays them.

8. **Separation boundaries**
   - The `Boundaries` package is the architectural seam: it isolates presentation concerns from game logic.
   - The `Controleurs` package is the orchestration seam: it isolates high-level game operations from entity state.
   - This makes the project closer to an MVC-style structure than a monolithic UI app.

9. **Build/runtime**
   - The project is Maven-based (`pom.xml`) and compiles to a runnable JAR in `target/`.
   - The presence of `target/classes` and `ProjetPirates-1.0-SNAPSHOT.jar` indicates a standard Java desktop application build, not a service deployment.

10. **Test/documentation assets**
   - The `Documentation` folder contains test cases, requirements, and coverage materials.
   - That suggests the project is being developed with explicit functional validation around special-case behaviors, especially exchange and poison cases.

11. **What to emphasize in an architecture diagram**
   - Show two presentation entry points feeding the same controller layer.
   - Show controllers split by gameplay responsibility rather than by UI screen.
   - Show `Pirate`, `Plateau`, and `TypeCase` as the core shared domain model.
   - Highlight special-case controllers as rule handlers attached to board squares.

12. **Key architectural takeaway**
   - The codebase is a layered, game-rule-driven Java application where the UI is replaceable, the controllers centralize game flow, and the entity layer holds the persistent game state.

Main entry points: [`Code/src/main/java/Controleurs/ControlJeuPirate.java`](https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/Controleurs/ControlJeuPirate.java) (Game flow), [`Code/src/main/java/Entite/Pirate.java`](https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/Entite/Pirate.java) (Pirate), [`Code/src/main/java/Entite/TypeCase.java`](https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/Entite/TypeCase.java) (Case type), [`Code/src/main/java/Controleurs/ControlCase.java`](https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/Controleurs/ControlCase.java) (Case rules)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["Presentation"]
  node_boundaries_ihm["GUI boundary<br/>entry boundary<br/>[BoundarieIHM.java]"]
  node_boundaries_text["Text boundary<br/>entry boundary"]
  node_frame3["Game window<br/>Swing form<br/>[frame3.java]"]
  node_background_panel["Background panel<br/>Swing component"]
end

subgraph group_controllers["Controllers"]
  node_control_jeu["Game flow<br/>orchestrator"]
  node_control_plateau["Board control"]
  node_control_pirate["Pirate control<br/>player controller<br/>[ControlPirate.java]"]
  node_control_move["Move control<br/>movement controller"]
  node_control_dice["Dice control"]
  node_control_end["End control<br/>end-game controller<br/>[ControlFinJeu.java]"]
  node_control_vie["Life check<br/>status checker"]
  node_control_poison["Poison check<br/>status checker"]
  node_control_case["Case rules<br/>case handler<br/>[ControlCase.java]"]
  node_control_bombe["Bomb case<br/>special case"]
  node_control_poison_case["Poison case<br/>special case"]
  node_control_exchange["Exchange case<br/>special case"]
  node_control_heal["Heal case<br/>special case"]
end

subgraph group_domain["Domain"]
  node_pirate(("Pirate<br/>entity<br/>[Pirate.java]"))
  node_plateau[("Plateau<br/>entity<br/>[Plateau.java]")]
  node_type_case{{"Case type<br/>enum<br/>[TypeCase.java]"}}
end

subgraph group_build["Build"]
  node_pom["Maven build<br/>build file<br/>[pom.xml]"]
end

node_boundaries_ihm -->|"start game"| node_control_jeu
node_boundaries_text -->|"start game"| node_control_jeu
node_boundaries_ihm -->|"renders"| node_frame3
node_boundaries_ihm -->|"uses"| node_background_panel
node_control_jeu -->|"coordinates"| node_control_plateau
node_control_jeu -->|"coordinates"| node_control_pirate
node_control_jeu -->|"drives"| node_control_move
node_control_jeu -->|"drives"| node_control_dice
node_control_jeu -->|"checks"| node_control_end
node_control_jeu -->|"checks"| node_control_vie
node_control_jeu -->|"checks"| node_control_poison
node_control_plateau -->|"reads/writes"| node_plateau
node_control_pirate -->|"reads/writes"| node_pirate
node_control_move -->|"updates"| node_pirate
node_control_move -->|"queries"| node_plateau
node_control_dice -->|"affects"| node_pirate
node_control_end -->|"evaluates"| node_pirate
node_control_vie -->|"evaluates"| node_pirate
node_control_poison -->|"evaluates"| node_pirate
node_control_case -->|"specializes"| node_control_bombe
node_control_case -->|"specializes"| node_control_poison_case
node_control_case -->|"specializes"| node_control_exchange
node_control_case -->|"specializes"| node_control_heal
node_control_bombe -->|"uses"| node_type_case
node_control_poison_case -->|"uses"| node_type_case
node_control_exchange -->|"uses"| node_type_case
node_control_heal -->|"uses"| node_type_case
node_plateau -->|"classifies"| node_type_case
node_pom -->|"builds"| node_boundaries_ihm

click node_boundaries_ihm "https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/Boundaries/BoundarieIHM.java"
click node_boundaries_text "https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/Boundaries/BoundariesJeuTextuel.java"
click node_frame3 "https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/IHM/frame3.java"
click node_background_panel "https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/IHM/BackgroundPanel.java"
click node_control_jeu "https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/Controleurs/ControlJeuPirate.java"
click node_control_plateau "https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/Controleurs/ControlPlateau.java"
click node_control_pirate "https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/Controleurs/ControlPirate.java"
click node_control_move "https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/Controleurs/ControlDéplacer.java"
click node_control_dice "https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/Controleurs/ControlLancerDeDes.java"
click node_control_end "https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/Controleurs/ControlFinJeu.java"
click node_control_vie "https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/Controleurs/ControlVerifierVie.java"
click node_control_poison "https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/Controleurs/ControlVerifierPoison.java"
click node_control_case "https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/Controleurs/ControlCase.java"
click node_control_bombe "https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/Controleurs/ControlCaseBombe.java"
click node_control_poison_case "https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/Controleurs/ControlCasePoison.java"
click node_control_exchange "https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/Controleurs/ControlCaseEchange.java"
click node_control_heal "https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/Controleurs/ControlCaseSoin.java"
click node_pirate "https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/Entite/Pirate.java"
click node_plateau "https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/Entite/Plateau.java"
click node_type_case "https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/Entite/TypeCase.java"
click node_pom "https://github.com/sabinelenny/projetpirates/blob/main/Code/pom.xml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_boundaries_ihm,node_boundaries_text,node_frame3,node_background_panel toneBlue
class node_control_jeu,node_control_plateau,node_control_pirate,node_control_move,node_control_dice,node_control_end,node_control_vie,node_control_poison,node_control_case,node_control_bombe,node_control_poison_case,node_control_exchange,node_control_heal toneAmber
class node_pirate,node_plateau,node_type_case toneMint
class node_pom toneRose
```

## Components

### Presentation

User-facing entry points and Swing UI pieces

- [GUI boundary](https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/Boundaries/BoundarieIHM.java): entry boundary · Graphical entry point that connects the Swing UI to game logic · `Code/src/main/java/Boundaries/BoundarieIHM.java`
- [Text boundary](https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/Boundaries/BoundariesJeuTextuel.java): entry boundary · Console/text entry point for playing the game · `Code/src/main/java/Boundaries/BoundariesJeuTextuel.java`
- [Game window](https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/IHM/frame3.java): Swing form · Designer-built main GUI frame for the pirate game · `Code/src/main/java/IHM/frame3.java`
- [Background panel](https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/IHM/BackgroundPanel.java): Swing component · Custom panel used for visual styling in the GUI · `Code/src/main/java/IHM/BackgroundPanel.java`

### Controllers

Game flow and rule orchestration

- [Game flow](https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/Controleurs/ControlJeuPirate.java): orchestrator · Top-level controller coordinating the main gameplay loop · `Code/src/main/java/Controleurs/ControlJeuPirate.java`
- [Board control](https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/Controleurs/ControlPlateau.java): board controller · Manages the board state and board-level operations · `Code/src/main/java/Controleurs/ControlPlateau.java`
- [Pirate control](https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/Controleurs/ControlPirate.java): player controller · Manages pirate/player state and updates · `Code/src/main/java/Controleurs/ControlPirate.java`
- [Move control](https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/Controleurs/ControlDéplacer.java): movement controller · Handles pawn movement across the board · `Code/src/main/java/Controleurs/ControlDéplacer.java`
- [Dice control](https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/Controleurs/ControlLancerDeDes.java): dice controller · Handles dice rolls and movement randomization · `Code/src/main/java/Controleurs/ControlLancerDeDes.java`
- [End control](https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/Controleurs/ControlFinJeu.java): end-game controller · Detects victory and game termination conditions · `Code/src/main/java/Controleurs/ControlFinJeu.java`
- [Life check](https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/Controleurs/ControlVerifierVie.java): status checker · Checks whether a pirate still has life remaining · `Code/src/main/java/Controleurs/ControlVerifierVie.java`
- [Poison check](https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/Controleurs/ControlVerifierPoison.java): status checker · Checks and tracks poison status effects · `Code/src/main/java/Controleurs/ControlVerifierPoison.java`
- [Case rules](https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/Controleurs/ControlCase.java): case handler · Common base for special-square behavior · `Code/src/main/java/Controleurs/ControlCase.java`
- [Bomb case](https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/Controleurs/ControlCaseBombe.java): special case · Applies bomb-square effects · `Code/src/main/java/Controleurs/ControlCaseBombe.java`
- [Poison case](https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/Controleurs/ControlCasePoison.java): special case · Applies poison-square effects · `Code/src/main/java/Controleurs/ControlCasePoison.java`
- [Exchange case](https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/Controleurs/ControlCaseEchange.java): special case · Applies pirate exchange-square effects · `Code/src/main/java/Controleurs/ControlCaseEchange.java`
- [Heal case](https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/Controleurs/ControlCaseSoin.java): special case · Applies healing-square effects · `Code/src/main/java/Controleurs/ControlCaseSoin.java`

### Domain

Core board-game state and types

- [Pirate](https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/Entite/Pirate.java): entity · Player or pawn state in the game · `Code/src/main/java/Entite/Pirate.java`
- [Plateau](https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/Entite/Plateau.java): entity · Board state and layout · `Code/src/main/java/Entite/Plateau.java`
- [Case type](https://github.com/sabinelenny/projetpirates/blob/main/Code/src/main/java/Entite/TypeCase.java): enum · Classification of board squares · `Code/src/main/java/Entite/TypeCase.java`

### Build

Maven packaging and runtime output

- [Maven build](https://github.com/sabinelenny/projetpirates/blob/main/Code/pom.xml): build file · Project build and packaging definition · `Code/pom.xml`

## Connections

- GUI boundary → Game flow: start game · GUI actions enter the shared game controller
- Text boundary → Game flow: start game · Text actions enter the shared game controller
- GUI boundary → Game window: renders · GUI boundary uses the main Swing frame
- GUI boundary → Background panel: uses · GUI boundary relies on custom Swing styling
- Game flow → Board control: coordinates · Main flow delegates board operations
- Game flow → Pirate control: coordinates · Main flow delegates pirate state updates
- Game flow → Move control: drives · Main flow triggers movement handling
- Game flow → Dice control: drives · Main flow triggers dice rolls
- Game flow → End control: checks · Main flow checks for game end
- Game flow → Life check: checks · Main flow checks life status
- Game flow → Poison check: checks · Main flow checks poison status
- Board control → Plateau: reads/writes · Board controller manipulates the board entity
- Pirate control → Pirate: reads/writes · Pirate controller manipulates player state
- Move control → Pirate: updates · Movement changes pirate position
- Move control → Plateau: queries · Movement depends on the board layout
- Dice control → Pirate: affects · Dice results determine pirate movement
- End control → Pirate: evaluates · End-game logic inspects player state
- Life check → Pirate: evaluates · Life checks inspect pirate health
- Poison check → Pirate: evaluates · Poison checks inspect pirate status
- Case rules → Bomb case: specializes · Base case behavior is refined by bomb rules
- Case rules → Poison case: specializes · Base case behavior is refined by poison rules
- Case rules → Exchange case: specializes · Base case behavior is refined by exchange rules
- Case rules → Heal case: specializes · Base case behavior is refined by healing rules
- Bomb case → Case type: uses · Bomb logic is tied to square types
- Poison case → Case type: uses · Poison logic is tied to square types
- Exchange case → Case type: uses · Exchange logic is tied to square types
- Heal case → Case type: uses · Healing logic is tied to square types
- Plateau → Case type: classifies · The board contains typed squares
- Maven build → GUI boundary: builds · Maven builds the application sources
