Chess Doctor is a powerful chess game analyzer that uses the Stockfish engine to provide detailed analysis of chess games. It identifies mistakes, blunders, and suggests better moves with explanations.
- Analyze chess games from PGN notation
- Identify blunders, mistakes, and inaccuracies
- Suggest better moves with detailed explanations
- Interactive web UI to visualize the analysis
- RESTful API for integration with other applications
- Python 3.7+
- Stockfish chess engine
- Flask
- Requests
- python-chess
-
Clone this repository:
git clone https://github.com/yourusername/chessdoctor.git cd chessdoctor
-
Install the required Python packages:
pip install flask requests python-chess
-
Install Stockfish:
- Linux:
sudo apt-get install stockfish
(Debian/Ubuntu) - macOS:
brew install stockfish
(using Homebrew) - Windows: Download from stockfishchess.org and install
- Linux:
The application consists of two parts:
- The Chess Doctor API (main.py)
- The Web UI (app.py)
python main.py
By default, the API runs on port 5000. You can specify a different port or Stockfish engine path:
python main.py --port 5001 --engine /path/to/stockfish
python app.py
The web UI runs on port 8080 by default and connects to the API on localhost:5000.
You can configure the API host and port using environment variables:
API_HOST=localhost API_PORT=5001 python app.py
- Open your browser and navigate to
http://localhost:8080
- Paste a PGN (Portable Game Notation) of a chess game into the text area
- Click "Analyze Game"
- Once analysis is complete, you can:
- View the game move by move using the navigation buttons
- See analysis for each move, with mistakes and blunders highlighted
- Click on any move in the analysis panel to jump to that position
Analyzes a chess game from PGN notation.
Request:
{
"pgn": "[PGN string of the chess game]"
}
Response:
{
"game_info": {
"white": "Player Name",
"black": "Opponent Name",
"event": "Tournament Name",
"date": "2023.01.01"
},
"moves": [
{
"move_number": 1,
"ply": 1,
"move": "e4",
"player": "White",
"is_white": true,
"quality": "good move",
"evaluation": "PovScore(Cp(+20), WHITE)",
"notation": "1. e4"
},
// More moves...
],
"errors": []
}
You can also run Chess Doctor in CLI mode to analyze a PGN file directly:
python main.py --cli --pgn_file game.pgn
- Stockfish - The powerful chess engine used for analysis
- python-chess - Chess library for Python
- chessboard.js - JavaScript chessboard component
- chess.js - JavaScript chess library