Inspiration

My friend and I like chess, and I like machine learning, so I thought it would be interesting to combine those and attempt to create a chess AI. We knew it would probably not be that great, considering we only have 36 hours (of which 24 will be spent sleeping), but it sounded fun.

What it does

Given a board position, the AI will tell you the probability that white will win, black will win, or a draw will occur.

How I built it

Python and tensorflow :)

Challenges I ran into

Several.

One of the first way creating an efficient data pipeline for the billions of chess games we downloaded. It took a while, and even with 16 cores and a multiprocessing algorithm (which I believe could be improved for 2x speed, but didnt have time for this), running it all night resulted in 66 million processed positions.

The next was figuring out why the model was pretty much giving the same evaluation all the time. This was solved by lowering regularization values on the model. Eventually they were removed entirely.

Overfitting also became a problem, which was solved by simply making the model smaller, sadly time did not allow me to fine-tune it and find a perfect fit for the AI.

Accomplishments that I'm proud of

In the end, the model was not as good as I had hoped. Although a strong framework is in place, which with a bit of time could be fine-tuned to provide interesting chess evaluations.

What I learned

I now understand how to use the python-chess library.

What's next for Chess Position Evaluator

I have several ideas for improvements. The model could be pre-trained to find possible moves, or tell which pieces are attacked. This would help give the model an understanding of chess which it would find useful when evaluating a position.

Built With

Share this project:

Updates