A chess engine written from scratch, including single player mode and multiplayer mode, written using Python. A C++ implementation is slowly in the works.
This project includes a full chess engine, gui engine, and an AI engine. The AI engine utilizes the minimax and alpha beta pruning algorithms. As mentioned, a C++ implementation is slowly in the works.
Human vs Human | Human vs AI (AI is controlling black) |
---|---|
First full human vs human test run | First full human vs AI test run |
To install this project, make sure you have the correct version of Python and Pygame. Certain versions of pygame are no longer supported on macOS Catalina.
- Switch to Python3.
- Follow the code below to create virtual environment and install the necessary libraries. (Currently tested on Python 3.7.9 with Pygame 2.0.0dev8 and Python 3.8.2 with Pygame 2.0.0 on macOS Catalina)
git clone https://github.com/boosungkim/python-chess.git
cd python-chess
python3 -m venv venv
source venv/bin/activate
pip install pygame
- To start the game, run
python3 -W ignore chess_gui.py
, then select the game mode you want to play in the command line. - To undo a move, press
u
. - To reset the board, press
r
.
All three engines were written by Boo Sung Kim, but the move log and the GUI engine code was initially inspired by Eddie Sharick and the AI engine was originally inspired by Sebastian Lague's pseudocode.
Special thanks to Savid for helping me beta test the chess game many times.
This project is licensed under the GNU GPLv3 License - see the LICENSE file for details.