Back to Projects
Open Source
| Java | university

Solitaire

Classic card game implementation with drag-and-drop mechanics and win-state detection.

Role
University Project Developer
Period
2025
Signal
Java GUI project
Why it matters

Implemented card movement, rules, and GUI interaction for a complete playable solitaire project.

Solitaire

A complete implementation of Klondike Solitaire featuring intuitive drag-and-drop card mechanics and polished visual feedback. Built with Java Swing, this project demonstrates object-oriented design principles and GUI programming.

The game includes all standard Klondike rules, automatic win detection, undo functionality, and smooth card animations that make gameplay feel responsive and satisfying.

Tech Stack

Java Swing JUnit Maven

Key Features

  • Complete Klondike Solitaire rules implementation
  • Intuitive drag-and-drop card movement
  • Automatic foundation building
  • Unlimited undo/redo functionality
  • Win detection and celebration animation
  • Card flip animations
  • Multiple draw modes (draw 1 or draw 3)

Technical Highlights

  • MVC architecture separating game logic from UI
  • Command pattern for undo/redo operations
  • Observer pattern for UI updates
  • Custom card rendering with anti-aliasing
  • Event-driven input handling
  • Efficient repaint with dirty rectangle tracking

Architecture

Object-Oriented Design

  • Card class with suit, rank, and face-up state
  • Pile abstract class with Tableau, Foundation, Stock subclasses
  • Game class orchestrating rules and win conditions
  • GamePanel handling all rendering and input

Design Patterns

  • MVC for clean separation of concerns
  • Command pattern for reversible moves
  • Observer for reactive UI updates
  • Factory for card deck creation

Challenges & Solutions

1

Implementing complex Klondike ruleset correctly

2

Creating smooth drag-and-drop with visual feedback

3

Managing Z-order for overlapping cards

4

Detecting valid moves efficiently

Gallery

Solitaire Screenshot 1
Solitaire Screenshot 2