Console-based Chess Game in Java
This project was developed following the instructions detailed in the Project Specification located in the root directory.
- Full chess rules: piece movements, captures, check, checkmate
- Special moves: castling, en passant, pawn promotion
- Turn-by-turn play via console input
- Board displayed in text form, with ANSI colors
- Exception handling for invalid moves
- Java 8+ (tested with Java 17)
- Eclipse IDE project structure (no external dependencies)
- Classes & Inheritance: Base
Piececlass with specific piece subclasses (King,Queen,Rook, etc.) - Enums:
Colorfor white/black,ChessPieceTypeif used - Exception Handling: Custom
ChessExceptionfor rule violations - Data Structures: 8×8 matrix for board, Java
Listfor move history - Encapsulation & Modularization: Separation into packages:
board,chess, andapplication(UI) - Game Logic: Validating moves, check/checkmate detection, turn management
- Console I/O: Reading positions like
e2 e4, and printing board with Unicode pieces
Use this structure to organize the code and resources:
ChessProject/
├─ src/
│ ├─ application/
│ │ └─ Program.java # Main class (console UI)
│ ├─ Board/
│ │ ├─ Board.java
│ │ ├─ BoardException.java
│ │ ├─ Piece.java
│ │ └─ Position.java
│ ├─ Chess/
│ │ ├─ ChessException.java
│ │ ├─ ChessMatch.java
│ │ ├─ ChessPiece.java
│ │ ├─ ChessPosition.java
│ │ └─ Color.java
│ ├─ Chess/Pieces/
│ │ ├─ Bishop.java
│ │ ├─ King.java
│ │ ├─ Knight.java
│ │ ├─ Pawn.java
│ │ ├─ Queen.java
│ │ └─ Rook.java
│ └─ ChessConsole/
│ └─ UI.java
├─ exampleMatchClips/ # MP4 clips of recorded game moves
├─ Enunciado.pdf # Project specification PDF
├─ README.md # This file
Check out some recorded game clips to see the moves in action: exampleMatchClips
- Clone or import this folder into your Java IDE (Eclipse, IntelliJ, etc.).
- Ensure project is set to JDK 8 or higher.
- Run the
application.Program(orUI/Programclass) as a Java application. - Follow on-screen instructions to enter moves in standard chess notation (e.g.,
e2 e4).
- This is strictly a backend console application; no GUI or web front-end.
- All input/output is via the terminal.
Developed by a Computer Engineering student to explore OOP and Java.