Skip to content

Ddilibe/dchess

Repository files navigation

Dirty Chess ♟️

Dirty Chess Logo

Description

Dirty Chess is a sophisticated, feature-rich desktop chess application built with Python. It leverages the power of the Pygame ecosystem and the Stockfish engine to provide a professional-grade chess experience. The project features a robust scene-based architecture, dynamic JSON-driven theming, and precise move validation using the python-chess library. Whether you are playing against another human or challenging the integrated AI, Dirty Chess offers a clean and responsive interface designed for both casual play and technical analysis.

Features

  • Engine Integration: Support for Stockfish for high-level AI move generation and position analysis.
  • Dynamic Theming: Fully customizable UI components, including pieces, boards, and buttons, via external JSON configuration files.
  • Scene Management: A structured state-machine approach managing Welcome, Menu, and Gameplay transitions.
  • Advanced Move Logic: Complete chess rule enforcement including promotion, castling, and stalemate detection.
  • Interactive UI: Real-time move history tracking, informational feedback panels, and sound effects for an immersive experience.
  • Configuration Management: Pydantic-validated settings for display, assets, and game board parameters.

Installation

Follow these steps to set up the project on your local machine:

  • Clone the Repository:

    git clone git@github.com:Ddilibe/Chess.git
    cd Chess
  • Environment Setup: Ensure you have Python 3.12+ installed. It is recommended to use a virtual environment:

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  • Install Dependencies:

    pip install .

    Note: The project requires pygame, pygame-gui, chess, and pydantic.

  • Stockfish Engine: Ensure the Stockfish binary is placed in the assets/engine/ directory as referenced in engine/engine.py.

Usage

To launch the application, run the main.py file from the root directory:

python main.py

Gameplay Controls

  • Select Piece: Left-click on any piece to see valid moves highlighted in blue.
  • Move: Click on a highlighted square to execute the move.
  • Promotion: A selection window will automatically appear when a pawn reaches the 8th rank.
  • Reset: Press R after a game concludes to restart.
  • Menu: Press ESC to return to the main menu at any time.

Technologies Used

Technology Purpose
Python 3.12 Core programming language
Pygame Graphics rendering and event handling
Pygame-GUI Interactive UI elements and theming
python-chess Move validation and board logic
Pydantic Data validation and settings management
Stockfish Chess engine for AI opponents

Author Info

Dilibe Fidelugwuowo


Python Version Pygame License

Readme was generated by Dokugen

About

Dirty Chess built with python

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages