https://github.com/hardcode3/pychess
A simple python chess wrapper for the stockfish engine
https://github.com/hardcode3/pychess
Last synced: about 1 year ago
JSON representation
A simple python chess wrapper for the stockfish engine
- Host: GitHub
- URL: https://github.com/hardcode3/pychess
- Owner: Hardcode3
- License: mit
- Created: 2022-11-14T18:07:29.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-07T13:04:07.000Z (over 3 years ago)
- Last Synced: 2025-01-23T19:38:50.623Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 28.1 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PythonChess




A pygame wrapper for the [stockfish chess engine](https://stockfishchess.org).
For more details, check their [GitHub repository](https://github.com/official-stockfish/Stockfish).
The wrapper is based on the python package [stockfish](https://github.com/zhelyabuzhsky/stockfish.git).
The view is developped using my pygame-toolkit, helping to create gui-like views in pygame.
# Cloning
Stockfish is not cloned as a submodule, clone it as follows:
```
git clone https://github.com/Hardcode3/PyChess.git
```
The content of the repository corresponding to the official realease is located under the [chess/external/stockfish path](chess/external/stockfish/).
Consider checking their [website](https://stockfishchess.org).
# Launching the app
To run the app, create a virtual environment or pip install the [requirements](requirements.txt).
## To create and activate a virtual environment on UNIX like systems
```
python3 -m venv venv
source venv/bin/activate
```
## To create and activate a virtual environment on Windows systems
```
python3 -m venv venv
.\venv\Scripts\activate
```
## To install the dependencies
```
pip install -r requirements.txt
```
If the [requirements.txt](requirements.txt) installation process fails, then try to install pygame in the virtual environment using the last dev version by manually typing:
The version used in the requirements file is indeed not compatible with python 3.11, but the dev version fixes the problem.
```
pip install pygame --pre
```
After this step, pip should have installed the dependencies and you should be able to launch the main program using:
```
python3 main.py
```
Note that the [main.py](main.py) file handles the compilation of the [Stockfish](https://stockfishchess.org) code for UNIX systems. For windows systems, it downloads the latest binaries and extract it.
If a stockfish executable is found, skips the compilation process, otherwise compiles and download necessary files using the included [Makefile](chess/external/stockfish/src/Makefile).
The game launches automatically after the process is done.
# Compatibility
This version is compatible with UNIX systems and now with Windows ones.
Just launch the main file and python does it for you.
[Stockfish for python](https://pypi.org/project/stockfish/) uses the compiled executable file available in [chess/external/src/](chess/external/src) as stockfish).
# Screenshots

