Chess Enigma is a Python-based chess game that combines an interactive graphical interface with a simple AI opponent. The AI leverages the minimax algorithm with alpha-beta pruning and evaluates moves using both material balance and piece-square tables to determine optimal strategies.
-
Main.py
The entry point of the game. It initializes the chess board, handles user input, and manages the game loop. Depending on the player's chosen color, it invokes the AI (via the minimax algorithm) to make moves. -
Board.py
Contains theDisplayBoardclass responsible for rendering the chessboard using Pygame. This file also includes thePiececlass to load and display chess pieces. -
Evaluation.py
Implements theEvalualtionclass, which evaluates board positions based on material, piece development, and game stage (early or late game). -
MiniMax.py
Implements the minimax algorithm with alpha-beta pruning. This file recursively explores potential moves using the evaluation function fromEvaluation.pyto determine the best move for the AI. -
Piece_Devolopment_values.py
Defines theBoardValuesclass, which contains piece-square tables that assign positional scores to pieces. These values guide the AI's decision-making process.
- Python 3.x
- pygame – for graphical interface and event handling
- python-chess – for board representation and move generation
-
Clone the repository or download the source files.
-
Install the required packages using pip:
pip install -r requirements.txt
To start the game, simply run:
python Main.pyA game window will open displaying the chessboard. Use the left mouse button to select and move pieces, and the right mouse button to deselect a chosen piece.
Enjoy playing Chess Enigma!