Skip to content

Latest commit

 

History

46 Commits

Folders and files

Repository files navigation

Memory Game

CI Release Java Coverage License

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.

Demo

Animated terminal walkthrough of Memory Game

Features

  • 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

Design

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.

Requirements

  • JDK 25 or newer
  • Maven 3.9 or newer

Run Locally

git clone https://github.com/fatmakahveci/MemoryGame.git
cd MemoryGame
mvn clean package
java -jar target/memorygame-1.0-SNAPSHOT.jar

Follow the terminal prompts to choose board dimensions and select cards by row and column.

Testing and Coverage

mvn clean verify

The command runs the JUnit and Mockito suite, applies the coverage gate, and writes the HTML report to target/site/jacoco/index.html.

Project Structure

src/
├── main/java/com/fatmakahveci/memorygame/   Application and domain code
└── test/java/com/fatmakahveci/memorygame/   Unit tests

Extension Ideas

  • Timed and difficulty-based modes
  • Persistent scores and a leaderboard
  • Multiplayer rules
  • Swing, JavaFX, or web-based presentation layers

Contributing

Read the contributing guide. Keep domain logic independent of console I/O and include tests for behavioral changes.

Project Resources