Back to Projects

Java Chess & Checkers

Java
Swing
OOP
University project

A Java Swing chess and checkers game: piece classes, move rules, mandatory capture, check and checkmate, built on a board GUI provided by the course. The CPU opponent was written with AI assistance.

Screenshot of Java Chess & Checkers

Java Chess & Checkers

A desktop game with chess and checkers, written in Java with Swing as a university project. I used it to practise object-oriented design: an interface for pieces, one class per piece type, and inheritance and polymorphism for the move rules.


Who did what

  • Provided by the course: the initial board GUI (the window, the board and the image assets).
  • Mine: the piece classes, the move rules and the game logic for chess and checkers.
  • CPU opponent and part of the menu: I designed the idea and the implementation was written with AI assistance.

What it does

  • Chess: movement and capture rules for every piece, check detection (a move that leaves your own king in check is rejected), checkmate, stalemate and pawn promotion.
  • Checkers: mandatory capture, promotion to king and king movement.
  • Pieces are dragged and dropped with the mouse, and valid moves are highlighted.

Chess Gameplay

Checkers Gameplay

Limitations

  • Chess has no castling, no en passant and no draw by repetition.
  • The CPU plays a random valid move, and in checkers it does not continue a chain of captures.

Project Links