← 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.
How the pieces fit together
- AI (checkerboard, then target) → Model (grid, fleet, shots): shoots
- Model (grid, fleet, shots) → View (JavaFX, no window)
- View (JavaFX, no window) → Window (JavaFX application): shown
- Tests (JUnit, Monocle) → View (JavaFX, no window)
- View (JavaFX, no window) → Screenshots (for the page): driven without a screen
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).
Screenshot made headless by the application's tests (JavaFX with Monocle), from a reproducible game.
cd projects/naval
mvn javafx:run
Tech stack
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