A fully-featured Chess application built with JavaFX, offering:
- Human vs. Human or Human vs. AI play (Stockfish engine integration)
- Adjustable AI difficulty (Easy, Medium, Hard, Expert)
- Themes (board color schemes), Dark Mode, and Board Flip
- Responsive to any screen size (auto-scales to available resolution)
- Full chess rules: legal moves, check/checkmate, stalemate, castling, pawn promotion

Example of the Classic theme in action, with dark mode toggled off.
- Play Modes
- Human vs. Human on the same machine
- Human vs. AI powered by Stockfish (configurable search depth)
- AI Difficulty
- Easy (depth 1), Medium (7), Hard (12), Expert (20)
- Full Rules Enforcement
- Legal move validation for all piece types (King, Queen, Rook, Bishop, Knight, Pawn)
- Castling (king- and queen-side) with move tracking
- Pawn double-step, en passant capture, promotion dialog
- Check, checkmate, and stalemate detection with flashing highlight
- Customizable UI
- Multiple board themes (light/dark squares, border accents)
- Toggle Dark Mode for the entire application
- Flip Board control to view from Black’s perspective
- Auto-scaling to fit any screen resolution (max square size 80px)
- Developer-Friendly
- Modular piece-drawing via
Drawableinterface - Clear separation of board logic, move validation, AI integration
- Easily extendable themes via
ChessThemeenum
- Modular piece-drawing via
- Java 11+ (JDK with JavaFX modules)
- Maven (or Gradle) for build and dependency management
- Optionally, download Stockfish and place the binary in your system path
# Clone the repository
git clone https://github.com/your-username/javafx-chess-game.git
cd javafx-chess-game
# Build with Maven
mvn clean package
# Run the application
mvn javafx:run
or, after packaging
java --module-path /path/to/javafx-sdk/lib \
--add-modules javafx.controls,javafx.fxml \
-jar target/chessgame.jar
- Play against AI: Check/uncheck “Play against AI”
- AI Difficulty: Select Easy, Medium, Hard, or Expert
- Play as: Choose White or Black color
- New Game: Reset board and settings
- Board Theme: Pick from predefined color schemes
- Toggle Dark Mode: Switch full UI to dark/light styling
- Flip Board: Mirror board orientation (lets Black view from bottom)
- Select & Move: Click your piece, then click a highlighted square
- Pawn Promotion: On reaching last rank, choose Queen, Rook, Bishop, or Knight
- Check Highlight: King in check flashes red
- Game Over Dialog: Offers “Play Again” or “Quit” on checkmate/stalemate
- Fork this repository
- Create your feature branch (
git checkout -b feature/YourFeature) - Commit your changes (
git commit -m "Add YourFeature") - Push to the branch (
git push origin feature/YourFeature) - Open a Pull Request
Please follow the existing code style and include relevant tests.