https://github.com/itaxbox/chessmaster
A full-featured chess game implementation built with Spring Boot.
https://github.com/itaxbox/chessmaster
chess css docker html java javascript junit problem-solving spring-boot
Last synced: 2 months ago
JSON representation
A full-featured chess game implementation built with Spring Boot.
- Host: GitHub
- URL: https://github.com/itaxbox/chessmaster
- Owner: ITAXBOX
- License: mit
- Created: 2025-02-28T15:33:49.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-27T07:19:55.000Z (about 1 year ago)
- Last Synced: 2025-06-30T08:44:40.494Z (12 months ago)
- Topics: chess, css, docker, html, java, javascript, junit, problem-solving, spring-boot
- Language: Java
- Homepage: https://chess.aliitawi.me
- Size: 1.24 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Chess Master
A full-featured chess game implementation with a Spring Boot backend, supporting all standard chess rules and features. This project serves as a foundation for a scalable chess platform with future plans for online multiplayer capabilities.

## ๐ฎ Features
- **Complete Chess Rules Implementation**:
- Standard piece movements and captures
- Special moves (castling, en passant)
- Check and checkmate detection
- Stalemate recognition
- Pawn promotion
- Draw conditions (perpetual check, insufficient material)
- **Game Controls**:
- Time control options
- Game state persistence
- Move history tracking
- **RESTful API**:
- Game creation endpoints
- Move validation and execution
- Game state queries
- Board representation
## ๐๏ธ Architecture
The project is structured following a clean, modular design:
### Core Components
- **Pieces**: Abstract base class with specific implementations (Pawn, Rook, Knight, etc.)
- **Board**: Manages the game state and piece positions
- **Game**: Coordinates game flow, rules enforcement, and state transitions
- **Timer**: Handles chess clock functionality for timed games
### Service Layer
Provides business logic to the controllers and handles game state management.
### API Layer
RESTful controllers exposing endpoints for game interaction.
### Frontend
Basic web interface for game visualization.
## ๐ Future Plans
- Online multiplayer capability
- User accounts and authentication
- Game history and statistics
- Rating system
- Tournament support
## ๐ป Technical Stack
- **Backend**: Java 21, Spring Boot 3.4.2
- **Build Tool**: Maven
- **Testing**: JUnit, with more than 60 comprehensive test cases
- **Frontend**: HTML, CSS and JavaScript
## ๐งช Testing
The project includes 69 test cases covering various aspects of the chess implementation:
- Piece movement validation
- Special move rules (en passant, castling)
- Check and checkmate scenarios
- Draw conditions
- Game state transitions
## ๐ง Development Journey
This project represents a significant milestone in my development journey. Starting from scratch with the core chess components (pieces, board), I built the entire system layer by layer:
1. Implemented the abstract `Piece` class and its concrete implementations
2. Developed the `Board` representation and state management
3. Created the `Game` logic to enforce rules and manage state
4. Added special chess rules like en passant (particularly challenging)
5. Built the service and controller layers
6. Implemented comprehensive testing (69 tests)
7. Added time control features
## ๐ Project Structure
```
src/
โโโ main/
โ โโโ java/
โ โ โโโ itawi/
โ โ โโโ chessgame/
โ โ โโโ ChessGameApplication.java
โ โ โโโ config/
โ โ โโโ controller/
โ โ โ โโโ ChessGameController.java
โ โ โโโ core/
โ โ โ โโโ board/
โ โ โ โโโ enums/
| | | โโโ exception/
โ โ โ โโโ game/
โ โ โ โโโ piece/
โ โ โ โโโ timer/
โ โ โ โโโ util/
โ โ โโโ dto/
โ โ โโโ service/
โ โ โโโ ChessGameService.java
โ โโโ resources/
โ โโโ static/
โ โ โโโ js/
โ โ โโโ chess.js
โ โโโ templates/
โโโ test/
โโโ java/
โโโ itawi/
โโโ chessgame/
โโโ ChessGameApplicationTests.java
โโโ core/
โโโ board/
โโโ game/
โโโ piece/
โโโ timer/
```
## ๐ Getting Started
### Prerequisites
- Java 21
- Maven
### Running the Application
1. Clone the repository
2. Run `mvn clean install`
3. Start the application with `mvn spring-boot:run`
4. Access the game at `http://localhost:8080`
## ๐ API Endpoints
- `POST /api/v1/chess/new-game` - Start a new game
- `GET /api/v1/chess/board` - Get the current board state
- `GET /api/v1/chess/status` - Get the current game status
- Additional endpoints for moves, promotions, and game state management
## ๐ฎ Challenges and Learnings
The most significant challenge during development was implementing the en passant rule correctly, which required careful consideration of piece state tracking and move validation. This project provided valuable experience in:
- Object-oriented design for complex rule systems
- State management in game applications
- Comprehensive test case development
- RESTful API design for interactive applications
---
Made with โ๏ธ and โค๏ธ by Itawi