- python-chess - move generation, move validation and support for common formats
- flask - lightweight WSGI web application framework
- torch - open source machine learning framework
./server.py # runs webserver on localhost:5000
Evaluate a given board state and come up with a good move to perform.
Why is it hard?
- ~10^40 legal board states
- ~10^120 different chess games
- ~30 moves per board state
- typical chess game ~80 moves
-
- minimizing the possible loss for a worst case (maximum loss) scenario
- reasonably works up to a search depth of 3
- already surprinsingly good opponent, but beatable
- improvement
- alpha–beta pruning
- decreases the number of nodes that are evaluated by minimax and therefore the computation time
- allows to search faster and works reasonably up to a depth of 4
-
- mapping to be learned: board state -> optimal move
- needs a lot of chess games to train with
- used PyTorch to implement the neural net
The net was trained on 110000 standard rated games played on lichess.org in Portable Game Notation (PGN) format.
Therefore, based on the above assumptions, the model was trained on approximately 8.8M board positions.