Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chess Logo

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)

🇪🇸 Leer en Español


Java Swing Maven


Features · Architecture · Quick Start · Demo




♟️ About the Project

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.


✨ Features

⚔️ Classic Gameplay

  • Strict validation of legal moves for each piece.
  • Full support for castling (kingside and queenside).
  • Special rules: En passant capture and pawn promotion.
  • Accurate Check and Checkmate detection algorithm.

💾 Match Management

  • Save and load system (state persistence).
  • Strategic options: declare a tie or surrender.
  • Side panel with a log of captured pieces.
  • Graphical interface with smart square highlighting.
  • 🌍 Dynamic Language Switching: Instantly switch the interface between English and Spanish during gameplay.



🏗️ System Architecture

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

🧩 Implemented Design Patterns

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).



🚀 Quick Start

Prerequisites

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 package

This 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)




📸 Demo

Here is a look at the game's main loading screen:

Splash Screen

Home Screen

Home Menu

Special Moves and Rules

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.

Kingside Castling

Queenside Castling

En Passant Capture

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.

Pawn Promotion

Check and Checkmate

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.

Check

Checkmate

Checkmate

Match Management

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

Save Match

Load Match

Load Match

Tie and Surrender

Tie

Tie

Surrender

Surrender

Tracking and Utilities

Captured Pieces Panel

Captured Pieces


📄 License and Credits

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).

About

Full-featured desktop Chess game built with Java & Swing. Includes MVC architecture, design patterns (Singleton/Factory), special chess rules, match saving, and dynamic bilingual (EN/ES) support.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages