Before running the engine, make sure to install all the necessary Python packages:
pip install -r requirements.txt
If you encounter errors related to CairoSVG, it's because the Cairo graphics library is missing. Follow these steps to fix the issue.
-
Download GTK3 Runtime:
- Visit GTK for Windows.
- Download the latest GTK3 Runtime installer for Win64.
-
Install GTK3:
- Run the downloaded
.exefile. - Make sure to check the option "Set up PATH environment variable" during installation.
- Run the downloaded
-
Open File Explorer and navigate to:
C:\Program Files\GTK3-Runtime Win64\bin -
Ensure the file
libcairo-2.dllis present.
If the GTK installer didn’t add the path automatically:
-
Press Win + R, type
sysdm.cpl, and press Enter. -
Go to Advanced → Environment Variables.
-
Under System Variables, find
Pathand click Edit. -
Click New and add:
C:\Program Files\GTK3-Runtime Win64\bin -
Click OK and restart your computer.
-
Uninstall existing packages:
pip uninstall cairosvg cairocffi pycairo
-
Reinstall CairoSVG:
pip install cairosvg
-
Ensure PyCairo is installed:
pip install pycairo
To avoid potential errors, manually add the Python scripts directory to your system’s PATH.
-
Open System Environment Variables:
- Press Win + R, type
sysdm.cpl, and press Enter. - Go to the Advanced tab and click Environment Variables.
- Press Win + R, type
-
Edit the PATH Variable:
-
Under System Variables, find
Pathand click Edit. -
Click New and add:
C:\Users\your_user\AppData\Roaming\Python\Python312\Scripts -
Click OK to save the changes.
-
These commands allow you to run a simple game where both opponents play random moves, just to verify the engine is functional.
python engine_driver.py
python3 engine_driver.py