This project implements a neural network model to learn and play chess using PyTorch. The model takes a 14x8x8 board representation as input and predicts the next move.
The neural network consists of:
- Convolutional layers to process the board state
- Fully connected layers for move prediction
- Output layer with around 1840 units representing possible moves
- Input: 14x8x8 tensor
- First 12 planes: Piece positions (both colors)
- 13th plane: Legal move destinations
- 14th plane: Legal move origins
- Output: One-hot encoded vector of 1840 possible moves
train.py
: Main training scriptmodel.py
: Neural network architecture definitiondata.py
: Functions for data loading and preprocessingagent.py
: Script to see the model plays vs itself
-
Install requirements:
pip install -r requirements.txt
-
Train the model:
python train.py
-
See the model play:
agent.ipynb
- Upload the model in a way that people can play against it
- Fine-tune for better decision making at the final rounds of the game
Contributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.