README.md
Description
This is a complete implementation of the game of Chess, developed in Java. The project focuses on strict adherence to official FIDE rules, offering a solid and feature-rich gaming experience.
Key Features Implemented:
- Comprehensive Rule Set: Includes all standard moves and special rules:
- Castling (including rules preventing it when in check or passing through an attacked square).
- En Passant capture, fully integrated with undo/redo capabilities.
- Pawn Promotion.
- Game State Detection: Accurate logic for determining:
- Check / Checkmate (
Mat). - Stalemate (
Nul/Draw).
- Check / Checkmate (
- User Interface (UI):
- Intuitive piece selection and movement highlighting.
- Visual indicators for the last move played and the King's position when in check.
- Keyboard controls for quick Undo/Redo operations.
- Internal Engine: Robust command pattern implementation allowing for extensive move history management and board state manipulation.
Current Status:
The core gameplay engine is finalized. Future development focuses on enhancing the user experience (UI promotion interface, timers) and introducing major features like multiplayer networking and AI integration.
Have fun playing!
Requirements
- Java JDK (openjdk 21.0.9)
- Maven (for dependency management and building)
Installation & Running
1. Clone the repository
git clone https://gitlab.com/altair908/chess
cd chess
2. Execute maven project
mvn clean install
mvn exec:java
🌐 Online Mode (Server)
The project includes a server component to enable online multiplayer. If you wish to host the server on a remote machine (such as a Raspberry Pi) or any environment without a graphical interface, follow these steps:
1. Build the project
Generate the executable (.jar) file on your local machine:
mvn clean package
2. Run the Server (Headless Mode)
Transfer the .jar file found in the target/ directory to your server, then execute it using the following command.
Note: The -Djava.awt.headless=true flag is mandatory for servers without a display. It prevents Java from attempting to load graphical libraries (JavaFX) that would cause a crash in a terminal-only environment.
java -Djava.awt.headless=true -cp target/chess-1.0-SNAPSHOT.jar main.chess.Server [PORT]
(The default port is 50.000 if no argument is provided).
3. Client Connection
To join your server, ensure you update the IP address in the ChessGameOnline class to point to your remote server's IP address.
📌 Roadmap — Chess Game
✅ Fixes (from bugs.txt)
- Board undo/redo updates
- En Passant undo
- Usage of
BoardListenerforrefreshUi - Prevent King from castling if the path is checked
🎨 Interface
- Use arrows to manage Undo / Redo
- Highlight the selected square
- Highlight the last move played
- Checkmate / Draw icons
- Highlight check position
- Promotion selection interface
- Add a timer
- (Optional) Undo / Redo arrow interface
- (Optional) Additional texture pack
- (Optional) "Drag and drop" piece movement
🧩 Backend (To be completed)
- Complete piece management (movement strategies)
- Commands / Internal engine
- Check / Checkmate / Draw detection
- Other special rules (...)
🌐 Server
- Server configuration
- Connection management
- Client ↔ Server exchanges
- User accounts + statistics
Bot
- Evaluation system
- Move simulation
- Add randomizer for openings
- Need to test if 2 board are equals (zobrist index)
- Transposition table to optimize
- (Optional) Add default openings
♟️ Game Features
- Save game (game state + commands)
- Load game
- Chess puzzles integration
- Move calculator (best move, engine style)
- (Optional) Custom puzzle creation
- (Optional++) Add Chess variants (chess 960)