← All projects

Games

Battleship

Rewrite of a game from my studies: battleship against the computer, as a JavaFX application.

Done Sprint S19 · 5 points
In short, no jargon for non-developersRead the summaryClose
What it is
Battleship against the computer, in a desktop application.
What it is for
A game from my studies, rewritten from scratch with the methods of a professional project: automatic tests, versions for several systems.
What it shows
Programming in Java, a language widespread in companies, with automatic tests over thousands of games.
Source code

How the pieces fit together

Diagram: AI → Model (shoots) ; Model → View ; View → Window (shown) ; Tests → View ; View → Screenshots (driven without a screen). shoots shown driven without a screen Model grid, fleet, shots AI checkerboard, then target View JavaFX, no window Window JavaFX application Tests JUnit, Monocle Screenshots for the page

A game in progress

A JavaFX application does not run in a browser: here is a game in progress, then the command to start it on your machine (Java 21 and Maven).

Tech stack

  • Java
  • JavaFX
  • Maven
  • JUnit

Who does what

Java
The game model (placement rules, shots, a computer that hunts then targets), in plain Java, testable without a user interface.
JavaFX
The desktop interface; tested headless (Monocle), it produces the project page's screenshot itself.
Maven
Building, tests and dependencies, on Linux, Windows and macOS.
JUnit
The model tests: placement rules, 2,000 random fleets, shots, sunk ships, the computer.

Definition of Done

  • Code reviewed, diff by diff
  • Unit and integration tests green
  • Green CI on Linux, Windows and macOS when compiled
  • README, REVIEW.md and DECISIONS.md up to date
  • Texts in French and English
  • Demo deployed and tested on mobile