This repository contains the design and implementation of two chess players using feed-forward neural networks (FFNNs) and a combination of deep belief networks and Siamese networks based on the DeepChess architecture. These networks were trained on publicly available game data from Lichess.org, and are simple enough to be trained on a personal computer. Our fully trained models performed competently enough to reliably beat a casual human player, and our chess player modelled on the DeepChess architecture comes close to being on par with open-source chess engines StockFish and Crafty.
- Operating Systems: Verified on Ubuntu 18.04
- Programming Languages: Python (version >= 3.7)
- Libraries: Keras, TensorFlow, pandas, numpy, python-chess, Jupyter Notebook
/source
contains the source code for our chess players.
/data
contains the Lichess dataset ingames.csv
as well as the script files for data preparation./python-chess-0.28.3
contains the source code for open-source chess interfacepython-chess
./Dense
contains the model for our feed-forward neural network./DeepChess
contains the model for our deep belief network / Siamese network based on the DeepChess architecture.Tester
contains the testing code pitting our models against chess engines StockFish and Crafty, as well as an interface for human players to play against our models.
Open up DataProcessing.ipynb
in /source/data
on Jupyter Notebook and run the code.
To train our feed-forward neural network, run python3 train.py
in /source/Dense
.
To train our DeepChess-based neural network, first run python3 dbn.py
and then python3 deepchess.py
in /source/DeepChess
.
To test our networks against other engines (executables provided in /source/Tester/engines
), open up PlayChess.ipynb
in Jupyter Notebook and change the parameters for the input model and the opponent engine. Then run the code.
To play against our models using the python-chess
interface, run python3 PlayAgainst.py
in /source/Tester
.
Our report can be found in the directory /report
.
See the LICENSE file for license rights and limitations (MIT).
This work was part of a course project for ECS 171 Machine Learning at the University of California, Davis, taught by Assoc. Prof. Ilias Tagkopoulos. It was largely influenced and adapted from the DeepChess paper (David, Netanyahu, Wolf) (https://arxiv.org/abs/1711.09667).
Contributors: Alexander Ricalde, Ezekiel Morton, Joel Lee, Lawrence Lee, Muhammed Halbutogari, Nick Van, Nikhila Thota, Pavit Bath, Vivienne Chiang, Yoosuf Shafi