A sophisticated chess engine powered by a neural network, featuring both a graphical user interface and a web interface for gameplay and training.
- Neural network-based chess AI
- Interactive chess board visualization
- Multiple game modes (AI vs Human, Free Play)
- Training system with grandmaster-style game generation
- Model management and persistence
- Support for common chess openings
- Real-time move evaluation visualization
- Clone the repository
- Install dependencies:
pip install -r requirements.txt
- Generate training games:
python generate_training_games.py
Run the web interface with:
python webui.py
This launches a Gradio-based web interface with the following features:
- Interactive chess board
- Move input and validation
- AI move calculation
- Model selection and management
- Training game generation
- Model training interface
Features include:
- Pygame-based graphical interface
- Neural network visualization
- Real-time move evaluation
- Direct mouse interaction
The AI can be trained using:
- Generated grandmaster-style games
- Custom game recordings
To generate training games:
python generate_training_games.py
The system supports various grandmaster openings including:
- Sicilian Defense
- Ruy Lopez
- Italian Game
- French Defense
- Caro-Kann
- Queen's Gambit
- King's Indian
- And more...
Game parameters can be adjusted in chess_config.json
:
{
"DEFAULT_NUM_GAMES": 20,
"MIN_MOVES_PER_GAME": 30,
"MAX_MOVES_PER_GAME": 100,
"RANDOMIZATION_FACTOR": 0.2,
"CENTER_CONTROL_BONUS": 1.2,
"DEVELOPMENT_BONUS": 1.1,
"CHECK_BONUS": 0.5,
"CAPTURE_BONUS": 0.3
}
webui.py
: Web interface implementationneural_network.py
: Neural network modelgame_recorder.py
: Game recording functionalitygenerate_training_games.py
: Training data generationchess_config.json
: Configuration parametersmodels/
: Saved model statesgames/
: Recorded and generated gamespieces/
: Chess piece images
The neural network evaluates chess positions using:
- Piece positions and values
- Board control
- Development factors
- King safety
- Material balance
- Tactical opportunities
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License - see the LICENSE.md file for details.