Skip to content

AnastasiiaDb/java-console-chess-game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Console Chess Game in Java πŸ°β™ŸοΈ

A professional console-based chess game implemented in Java.
Demonstrates strong object-oriented design, game logic implementation, and interactive console features.


πŸš€ Why This Project

This project showcases:

  • Object-Oriented Programming: Each chess piece is a separate class implementing isValidMove().
  • Core Game Logic: Full chess rules including castling, en passant, pawn promotion, check, and checkmate detection.
  • Interactive Console Interface: Move timer (30 seconds per move).
  • Clean Code & Structure: Designed for easy extension to GUI, AI opponent, or networked multiplayer.

This demonstrates skills relevant for Java development, game development, and algorithmic problem solving.


🎯 Features

  • Standard chess rules (movement, check, checkmate, stalemate)
  • Pawn promotion with choice of Queen, Rook, Bishop, or Knight
  • Castling (king-side and queen-side)
  • En passant capture
  • Move timer (30 seconds per move)
  • Move history tracking
  • Easily extendable for GUI or network play

πŸ— Project Structure

src/main/java/com/example/chess/
β”œβ”€β”€ ConsoleMain.java       # Entry point of the console game, handles user interaction
β”œβ”€β”€ logic/
β”‚   β”œβ”€β”€ GameLogic.java    # Core game rules, move validation, special moves
β”‚   └── Move.java         # Representation of a move, coordinates and promotion
└── model/
    β”œβ”€β”€ Piece.java         # Abstract base class for all chess pieces
    β”œβ”€β”€ Pawn.java          # Pawn implementation, including movement and en passant
    β”œβ”€β”€ Rook.java          # Rook implementation, including castling logic
    β”œβ”€β”€ Knight.java        # Knight movement implementation
    β”œβ”€β”€ Bishop.java        # Bishop movement implementation
    β”œβ”€β”€ Queen.java         # Queen movement implementation
    └── King.java          # King movement implementation, including castling


πŸ›  Technical Details

  • Language: Java 24 (OpenJDK, latest stable version used during development)
  • Object-Oriented Design:
    • Each chess piece (Pawn, Rook, Knight, Bishop, Queen, King) is implemented as a separate class inheriting from the abstract Piece class.
    • The GameLogic class handles all game rules, validations, special moves, and game state.
  • Move Validation:
    • Each piece implements its own isValidMove() method.
    • Supports standard chess movement rules, including diagonal, horizontal, vertical, and knight jumps.
  • Special Moves:
    • Castling: King-side and Queen-side, with automatic rook movement.
    • En Passant: Captures handled according to chess rules.
    • Pawn Promotion: Supports promotion to Queen, Rook, Bishop, or Knight, selectable by the player.
  • Game State Tracking:
    • Keeps track of current player turn (white/black).
    • Detects check, checkmate, and stalemate conditions.
    • Maintains move history for potential future features like undo/redo.
  • Timers:
    • Interactive 30-second move timer implemented for console gameplay.
  • Scalability & Extensibility:
    • Code structured for easy extension to GUI, AI opponent, or networked multiplayer.
    • Clean separation of concerns between model (pieces), logic (game rules), and interface (console).
  • Coding Standards:
    • Clean, readable, and maintainable code following modern Java practices.
    • Fully uses type safety, encapsulation, and modular design.
  • Tools & Environment:
    • Developed using IntelliJ IDEA (latest 2025 version)
    • Compiled and tested with OpenJDK 24
    • Cross-platform compatibility (Windows, Mac, Linux)

πŸ’‘ Potential Enhancements

  • Add GUI using JavaFX or Swing
  • Add AI opponent
  • Add networked multiplayer
  • Add undo/redo move functionality

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages