Back to Projects

Java Chess & Checkers

Java
Swing
OOP
Game AI
Algorithms

A robust Swing-based game engine demonstrating strict OOP principles and Game AI.

Screenshot of Java Chess & Checkers

Java Chess & Checkers Engine

A pure Java implementation of classic board games, prioritizing Clean Architecture and Object-Oriented Design.

This project was built to master the fundamentals of Software Architecture without relying on modern game engines.


🏛️ Architecture: Strict OOP

The core strength of this engine is its adherence to Object-Oriented Designing Principles:

  • Polymorphism: A base Piece class defines movement contracts. Subclasses like Bishop, Knight, and King implement specific move validation logic.
  • Encapsulation: Game states (Check, Checkmate, Stalemate) are isolated from the rendering logic.
  • Inheritance: Shared logic between Chess and Checkers is abstracted to reduce code duplication.

🤖 Intelligent Game Logic

Move Validation

The engine doesn't just "move pieces"; it simulates the board state to prevent illegal moves (e.g., you cannot make a move that leaves your King in check).

  • Chess: Handles En Passant, Castling, and Pawn Promotion.
  • Checkers: strict enforcement of Mandatory Captures and Multi-Jump chains.

CPU Opponent

A single-player mode that evaluates board states to make valid moves against the player.

Chess Gameplay


🎨 Custom Swing GUI

Instead of using standard buttons, I implemented a custom Graphics2D rendering pipeline.

  • Smooth Rendering: Double-buffered painting to prevent flickering.
  • Drag & Drop: Intuitive mouse interaction for picking up and placing pieces.
  • Dynamic Highlighting: Visual cues for valid moves (Green) and captures (Red).

Checkers Gameplay

Project Links