A Reinforcement Learning Chess Engine ;)
-
Reinforcement Learning Modules
- The engine is made up of three workers:
self
,opt
andeval
.- self is the self play module that utilizes the best model trained to generate new games to train the model.
- opt is the training module that trains the model, and generates new models to be evaluated.
- eval is the evaluation module that compares the newley generated model to the current model and replaces best model if it is proven to be inferior
- The engine is made up of three workers:
-
GUI module
- the gui module allows the engine to communicate with gameboards throughout the UCI protocol (Universal Chess Interface)
- also allows the engine to communicate with a chess interface - all that is needed is to point it to yUiUCI.bat
-
Setup
- install Anaconda3 python3.8
- install my anaconda env
chessengine.yml
- install Cuda 10.1 to utilize GPU accelerated training
- adjust the .bat files replacing
ali20
with your system's name, for exampleC:\Users\[system_name]\anaconda3\Scripts\
-
Use
- In order to train the model run self, opt and eval functions.
- Adjust settings used in normal config file in order to further tailor the training process to the equipment you are using
-
Recommended Equipment
-
I generated self play games for 200 hours, ran the opt function for all generated play data, and then used the eval function to evaluate models generated in order to find best model.
-
All training was done on a K80 gpu using GCP (Google Cloud Platform).
-
Any CPU could be used, but I recommend at least a 4 core CPU with a minimum clockspeed of 4 Ghz, and system memory should at least be 32 GB's to avoid any bottlenecks.
-
-
Resources used
- Surag's Alpha Zero Implementation
- Deepminds Alpha Zero config played a huge role as inspiration for the initial settings used.
- Zeta36's AlphaZero Implementation served a huge role as inspiration for the structure and design of the engine, however the model, weights and settings used are independent of those chosen by Zeta36