How vianneychaillou/java-battleship-project works
Java Battleship is a Swing desktop game organized around MVC. The player places ships, starts combat, and targets the opponent’s grid; the match model records shots, tracks turns and win conditions, and makes the computer retaliate after each player turn. The model also handles randomized fleet placement, hit/miss/sunk results, and five ship types; the view renders both grids and status feedback. Edges rely on sampled source or README evidence; unsampled implementation details are not inferred.
Main entry points: Flotte.java Fleet and shots · Partie.java Match state · Bateau.java Ship behavior · PanneauGrille.java Battle grids
Components 19
Swing interface
- Game window
vue/Fenetre.java - Battle grids
vue/PanneauGrille.java - Status panel
vue/PanneauInformation.java
Input handling
- Placement input
controleur/GestionPlacement.java - Combat input
controleur/GestionSouris.java
Match flow
- Application entry
Application.java - Match state
modele/Partie.java - Computer targeting
modele/Partie.java - Game phases
modele/EtatJeu.java - Game constants
modele/Constantes.java
Fleet and ships
- Fleet and shots
modele/Flotte.java - Ship behavior
modele/Bateau.java - Grid position
modele/Position.java - Torpedo boat
modele/LanceTorpille.java - Destroyer
modele/ContreTorpilleur.java - Submarine
modele/SousMarin.java - Battleship
modele/Cuirasse.java - Aircraft carrier
modele/PorteAvions.java
Other components
- Player
Connections 29
- Application entry → Match state: starts
Application.java - Application entry → Game window: opens
Application.java - Player → Battle grids: clicks
README.md - Battle grids → Placement input: registers
vue/PanneauGrille.java - Battle grids → Combat input: registers
vue/PanneauGrille.java - Placement input → Match state: checks phase
controleur/GestionPlacement.java - Placement input → Fleet and shots: removes ship
controleur/GestionPlacement.java - Combat input → Match state: registers shot
controleur/GestionSouris.java - Game window → Match state: owns match
vue/Fenetre.java - Game window → Battle grids: creates
vue/Fenetre.java - Game window → Status panel: updates
vue/Fenetre.java - Battle grids → Fleet and shots: renders
vue/PanneauGrille.java - Match state → Fleet and shots: manages fleets
modele/Partie.java - Match state → Game phases: tracks phase
modele/Partie.java - Match state → Computer targeting: runs retaliation
modele/Partie.java - Computer targeting → Fleet and shots: fires shots
modele/Partie.java - Fleet and shots → Ship behavior: creates and tests
modele/Flotte.java - Fleet and shots → Grid position: records shots
modele/Flotte.java - Fleet and shots → Torpedo boat: places
modele/Flotte.java - Fleet and shots → Destroyer: places
modele/Flotte.java - Fleet and shots → Submarine: places
modele/Flotte.java - Fleet and shots → Battleship: places
modele/Flotte.java - Fleet and shots → Aircraft carrier: places
modele/Flotte.java - Ship behavior → Grid position: builds segments
modele/Bateau.java - Torpedo boat → Ship behavior: extends
modele/LanceTorpille.java - Destroyer → Ship behavior: extends
modele/ContreTorpilleur.java - Submarine → Ship behavior: extends
modele/SousMarin.java - Battleship → Ship behavior: extends
modele/Cuirasse.java - Aircraft carrier → Ship behavior: extends
modele/PorteAvions.java