Dado555 / chessmc

MCTS based chess engine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

chessmc

MCTS based chess engine

Most chess engines use alpha-beta search algorithm, but chessmc uses Monte Carlo Tree Search (MCTS) algorithm.
In the past decade or so, MCTS really has been growing to be much more popular than alpha-beta.

Chessmc should be similar to AlphaZero in the way that it does not use random rollouts.
Deep learning is used to evaluate board position. Neural net is trained to reproduce Stockfish’s evaluation function.
The output of the evaluation process is a value called the centipawn (cp). Centipawns correspond to 1/100th of a pawn and are the most commonly used method when it comes to board evaluations.

Every board position has been labeled as Winning, Losing or Draw according to the cp Stockfish assigns to it.
A label of Winning has been assigned if cp > 1.5, Losing if it was < −1.5 and Draw if the cp evaluation was between these 2 values.

Data

https://www.pgnmentor.com/files.html

Model

Neural Network architecture: MLP -> input: 768 | hidden: 256 | hidden: 64 | output: 3
Leaky ReLU and Dropout 0.5 on both hidden layers
Optimizer: Adam (with default params)
Trained 100 epochs on 500_000 examples with 128 batch size
Train loss: 0.08
Test accuracy: 76%

Demo

chessmc

Dependencies

1. python-chess
2. numpy
3. pytorch

Usage

1. python main.py  # runs web server on localhost:5000
2. Web browse to localhost:5000

About

MCTS based chess engine


Languages

Language:Python 90.9%Language:HTML 9.1%