A terminal-based card-matching game built to demonstrate testable Java design. Domain rules are isolated from console input and output, so gameplay can be exercised deterministically without manual interaction.
- Configurable board dimensions and turn-based matching
- Input validation for board positions and repeated selections
- Clear separation between game rules, board state, and terminal UI
- Injectable input abstraction for deterministic tests
- Unit coverage for the engine and core value objects
- JaCoCo reports and a 60% instruction-coverage quality gate
ConsoleUI + ScannerInput
│
▼
GameEngine
│ │
▼ ▼
Board Player
│
▼
Cell + Position + TurnResult
GameEngine coordinates turns and scoring. Board owns card state and matching rules. The Input interface keeps terminal I/O outside the domain layer and can be replaced with a test double.
- JDK 25 or newer
- Maven 3.9 or newer
git clone https://github.com/fatmakahveci/MemoryGame.git
cd MemoryGame
mvn clean package
java -jar target/memorygame-1.0-SNAPSHOT.jarFollow the terminal prompts to choose board dimensions and select cards by row and column.
mvn clean verifyThe command runs the JUnit and Mockito suite, applies the coverage gate, and writes the HTML report to target/site/jacoco/index.html.
src/
├── main/java/com/fatmakahveci/memorygame/ Application and domain code
└── test/java/com/fatmakahveci/memorygame/ Unit tests
- Timed and difficulty-based modes
- Persistent scores and a leaderboard
- Multiplayer rules
- Swing, JavaFX, or web-based presentation layers
Read the contributing guide. Keep domain logic independent of console I/O and include tests for behavioral changes.
