Skip to content

Latest commit

Β 

History

History
74 lines (49 loc) Β· 1.89 KB

File metadata and controls

74 lines (49 loc) Β· 1.89 KB

Chess AI Console GUI

This is a console-based chess game with a simple graphical interface built using Python and Pygame. It includes an AI opponent powered by the Minimax algorithm.

🧠 Features

  • Play against a friend locally or challenge the AI.
  • AI uses a depth-limited Minimax algorithm to determine optimal moves.
  • Legal move validation with check, checkmate, and stalemate detection.
  • Undo last move functionality.
  • Simple GUI built with pygame and chess piece images.

πŸ—‚οΈ Project Structure

Chess--AI-ConsoleGUI/
β”œβ”€β”€ ChessMain.py          # Main file to run the game
β”œβ”€β”€ ChessEngine.py        # Core chess logic and game state management
β”œβ”€β”€ SmartMoveFinder.py    # AI logic using Minimax
β”œβ”€β”€ images/               # Chess piece images
└── README.md             # Project documentation

πŸ•ΉοΈ Controls

  • Click on a piece to select it and click on the destination square to move.
  • Press z to undo the last move.

πŸš€ Getting Started

Requirements

  • Python 3.x
  • Pygame

Installation

  1. Clone the repository:
git clone https://github.com/usmans58/Chess--AI-ConsoleGUI.git
cd Chess--AI-ConsoleGUI
  1. Install dependencies:
pip install pygame
  1. Run the game:
python ChessMain.py

🧠 AI Logic

The AI uses the Minimax algorithm with a simple board evaluation based on piece values. It searches future states up to a limited depth to choose the best move.

πŸ”§ Possible Improvements

  • Add castling, en passant, and draw by repetition support.
  • Improve the evaluation function to account for position, mobility, and king safety.
  • Add difficulty levels by varying AI search depth.
  • Enhance GUI with animations and sound effects.

πŸ“œ License

This project is open-source and available under the MIT License.

πŸ‘¨β€πŸ’» Author

Created by Usman