A JavaFX-based chess game implementation with both standard chess rules and a custom variant mode.
- Standard Chess: Traditional chess with classic rules and piece movements
- Variant Mode: Custom chess variant with additional piece types and modified rules
- ✅ Interactive GUI built with JavaFX
- ✅ Turn-based gameplay (White vs Black)
- ✅ Legal move validation
- ✅ Check detection and highlighting
- ✅ Move highlighting (selected piece and valid moves)
- ✅ Surrender options for both players
- ✅ Visual piece representation with custom images
- King (K/k)
- Queen (Q/q)
- Rook (R/r)
- Bishop (B/b)
- Knight (N/n)
- Pawn (P/p)
- VAR1 (V/v)
- VAR2 (S/s)
- VAR3 (M/m)
- Language: Java 20
- Framework: JavaFX 20
- Build Tool: Maven
- Testing: JUnit 5.9.2
- Architecture: MVC Pattern
src/
├── main/
│ ├── java/
│ │ ├── board/ # Chess board logic
│ │ │ ├── Board.java
│ │ │ ├── FictiveBoard.java
│ │ │ ├── Rules.java
│ │ │ └── Tile.java
│ │ ├── main/ # Application entry and controllers
│ │ │ ├── ChessApplication.java
│ │ │ └── ChessController.java
│ │ ├── pieces/ # Piece definitions and move logic
│ │ │ ├── Move.java
│ │ │ ├── Piece.java
│ │ │ └── PieceType.java
│ │ └── module-info.java
│ └── resources/
│ └── main/
│ └── chess.fxml # JavaFX UI layout
- Java Development Kit (JDK) 20 or higher
- Maven 3.6+ for build management
- JavaFX 20 runtime (handled by Maven dependencies)
-
Clone the repository:
git clone <repository-url> cd Java_Chess
-
Build the project:
mvn clean compile
-
Run the application:
mvn javafx:run
Or using the wrapper:
# Windows .\mvnw.cmd javafx:run # Unix/Linux/macOS ./mvnw javafx:run
- Launch the game - A welcome window will appear with game mode selection
- Choose game mode:
- Mode Normal: Standard chess rules
- Mode Variant: Custom variant with special pieces
- Game Controls:
- Click on a piece to select it (only pieces of the current player's turn)
- Valid moves will be highlighted in green
- Click on a highlighted square to move the piece
- Click elsewhere to deselect the current piece
- Surrender Options:
- A surrender window allows either player to forfeit the game
- Choose "Abandon blancs" (White surrenders) or "Abandon noirs" (Black surrenders)
- Follows traditional chess rules
- All standard piece movements and special moves
- Check detection with red highlighting
- Turn-based play alternating between white and black
- Modified starting position:
msvbkvsm/p1pppp1p/1pp2pp1/8/8/1PP2PP1/P1PPPP1P/MSVBKVSM - Includes three special piece types (VAR1, VAR2, VAR3)
- Different win condition: Game ends when a player is in check (inverse of checkmate)
The game uses FEN (Forsyth-Edwards Notation) for initial board setup:
- Standard:
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR - Variant:
msvbkvsm/p1pppp1p/1pp2pp1/8/8/1PP2PP1/P1PPPP1P/MSVBKVSM
- 8x8 chessboard with alternating light (240,217,181) and dark (181,136,99) squares
- Piece images with transparent backgrounds
- Green highlighting for selected pieces and valid moves
- Red highlighting for pieces in check
- 80x80 pixel tile size for optimal visibility
mvn clean compilemvn testmvn clean package- JavaFX Controls & FXML (v20): UI framework
- JUnit Jupiter (v5.9.2): Testing framework
- Maven Compiler Plugin (v3.11.0): Java 20 compilation
- JavaFX Maven Plugin (v0.0.8): JavaFX application execution