Chess Game - OOP Academic Project
A classic chess experience brought to the desktop. Manage matches, perform special moves, and master the board with an intuitive graphical interface.
🌍 Now featuring full dynamic language switching (English/Spanish)
Features · Architecture · Quick Start · Demo
This is a project developed for the Object-Oriented Programming course. It consists of a fully functional chess game built with Java.
This project was developed using software design patterns (such as MVC, Singleton, and Factory). From standard moves to complex logic like castling, pawn promotion, and en passant, everything is integrated into a visual interface (GUI) built on Java Swing.
|
|
The project follows an adapted Model-View-Controller (MVC) architecture, separating the heavy game logic from the user interface rendering.
IC-2101-Proyecto-2/
│
├── Ajedrez3/Ajedrez/
│ ├── src/main/java/ajedrez/
│ │ ├── control/ # Control and validation logic
│ │ │ ├── Control.java # Main controller
│ │ │ └── DataVerificator.java # Utilities
│ │ │
│ │ ├── interfaz/ # Views (Java Swing)
│ │ │ ├── Ajedrez.java # Main board window
│ │ │ ├── LoadMatch.java # Load menu
│ │ │ └── SaveMatch.java # Save menu
│ │ │
│ │ └── logica/ # Model (Rules and pieces)
│ │ ├── Tablero.java # Board state management
│ │ ├── Piece.java # Base class for pieces
│ │ └── PieceFactory.java # Piece creator
│ │
│ ├── src/main/resources/ # Assets (Images, icons)
│ └── pom.xml # Dependencies (Maven)
└── assets/ # Demos and documentation
| Pattern | Description and Usage |
|---|---|
| Singleton | Used in the Control and Idioma classes to ensure only a single global instance coordinates the match and the language state. |
| Factory Method | Implemented in PieceFactory to delegate and centralize the creation of different pieces (King, Queen, Pawn, etc.) based on their type. |
| MVC | Separation of concerns between the Swing views (interfaz), business rules (logica), and the mediator (control). |
To compile and run this project, you need:
| Software | Recommended Version |
|---|---|
| Java JDK | v17 or higher |
| Apache Maven | v3.6 or higher |
📦 1. Compile from source
To compile the project and package it into a portable executable, open a terminal in the directory where pom.xml is located:
cd Ajedrez3/Ajedrez
mvn clean packageThis will download the necessary dependencies and generate the Ajedrez-1.0-SNAPSHOT-jar-with-dependencies.jar file in the target/ folder.
🎮 2. Run the compiled version (JAR)
Once the project is packaged, you can run the .jar file directly. This will open the splash screen followed by the full game.
cd Ajedrez3/Ajedrez/target
java -jar Ajedrez-1.0-SNAPSHOT-jar-with-dependencies.jar(💡 On Windows environments, you can also simply double-click the .jar file)
Here is a look at the game's main loading screen:
Kingside and Queenside Castling
To castle, you must first click the King and then click the Rook you want to castle with. The game will calculate if the path is clear and if the conditions are met to perform the move automatically.
En Passant Capture
Pawn Promotion
When a pawn reaches the opposite end of the board, a menu is displayed allowing the player to choose to promote it to a Queen, Rook, Knight, or Bishop.
Check
The game's validation system prevents you from making moves that expose your own King ("suicidal" moves). If you are in check, the game will not allow you to advance until you make a valid move that defends the King.
Checkmate
Saving and Loading Matches
When saving a match, a file selector will open. It is very important to select the desired path and manually add the .bin extension at the end of the name (e.g., match_01.bin) to ensure the file is saved and can be loaded correctly.
Save Match
Load Match
Tie and Surrender
Tie
Surrender
Captured Pieces Panel
This project is distributed under the MIT license. Developed by Daniel Alemán and Luis Meza as an academic project for the Object-Oriented Programming (OOP) course at the Instituto Tecnológico de Costa Rica (TEC).












