zach1502 / BetaChess

BetaChess is an MCTS-based Chess Engine with Deep Neural Networks inspired by AlphaZero, featuring customizable DNN architecture, self-play training with MCTS, and UCI support.
3 stars 0 forks source link

BetaChess: MCTS-based Chess Engine with Deep Neural Networks

This project uses Monte Carlo Tree Search (MCTS) and a deep learning model to create a chess AI. The code is organized into four main Python scripts: beta_chess.py, MCTS.py, pipeline.py, and encoding.py.

Requirements

beta_chess.py

beta_chess.py contains the following classes and functions:

These are inspired by the AlphaZero paper and take a similar approach to the neural network architecture and training.

MCTS.py

MCTS.py is a Python script that contains a customized implementation of the Monte Carlo Tree Search algorithm. It includes the following key features:

encoding.py

encoding.py only contains helper functions to encode and decode the board and any move on the board.

pipeline.py

pipeline.py is a Python script that combines the chess AI training and Monte Carlo Tree Search (MCTS) self-play into a single pipeline. It simply contains 2 functions:

To run the pipeline, execute the pipeline.py script. It will create the necessary directories if they don't exist and run the MCTS and neural network training for the specified number of iterations.

Running the code

  1. Install the required dependencies.
pip install -r requirements.txt
  1. Execute the pipeline.py script to run the entire pipeline with the specified number of iterations.
python pipeline.py

This will run the MCTS self-play and neural network training for the specified number of iterations.

Additional Notes