A professional, production-ready chess game analysis tool with interactive web interface
Features β’ Quick Start β’ Installation β’ Documentation β’ Contributing
- β¨ Deep Game Analysis - Powered by Stockfish engine for accurate position evaluation
- π― Move Classification - Identifies brilliant moves, blunders, mistakes, and inaccuracies
- π Accuracy Metrics - Calculate player accuracy and performance ratings
- π Critical Moments - Highlight turning points and missed opportunities
- π PGN Support - Parse and analyze standard PGN (Portable Game Notation) files
- βοΈ Interactive Chessboard - Replay games move-by-move with visual position display
- π Evaluation Graph - See position evaluation change throughout the game
- π§ Coaching Tips - Get beginner-friendly explanations for every type of mistake
- π Paste PGN - Analyze games directly from clipboard without file upload
- β Sample Games - Try analysis with pre-loaded famous games
- β¨οΈ Keyboard Controls - Navigate with arrow keys for quick replay
- π± Responsive Design - Works seamlessly on desktop, tablet, and mobile
- π JSON - Machine-readable format for integration
- π Text - Human-readable analysis reports
- π HTML - Rich formatted reports with diagrams
- π Statistics - Detailed game statistics and insights
- π³ Docker Support - Easy deployment with Docker and docker-compose
- β‘ Fast Performance - Optimized for analyzing multiple games
- π Error Handling - Robust error handling and logging
- β Well Tested - Comprehensive unit and integration tests
- π Documentation - Complete API and usage documentation
Never analyzed a chess game before? No problem! Here's how to get started in 3 minutes:
-
Export your game as a PGN file:
- On Chess.com: Archive β Click game β Share β Download PGN
- On Lichess: Click game β Export β Download PGN
-
Visit Chess Analyst and upload your file
-
Review your analysis - see your mistakes, accuracy, and get tips to improve!
Or try instantly: Click "Try Sample" to analyze a famous game without uploading anything!
π New to chess analysis? Read our Complete Beginner's Guide
- Python 3.8 or higher
- Stockfish chess engine (Download Here)
# Clone the repository
git clone https://github.com/lekhanpro/chess-post-game-analyst.git
cd chess-post-game-analyst
# Install dependencies
pip install -r requirements.txt
# Install the package
pip install -e .# Build and run with Docker Compose
docker-compose up -d
# Access web interface at http://localhost:5000# Analyze a single PGN file
chess-analyst analyze game.pgn
# Specify output format
chess-analyst analyze game.pgn --format json
# Save analysis to file
chess-analyst analyze game.pgn --output analysis.txt# Analyze with custom engine depth
chess-analyst analyze game.pgn --depth 20
# Show only blunders and mistakes
chess-analyst analyze game.pgn --threshold mistake
# Analyze multiple games
chess-analyst analyze games/*.pgn --output results/# Set Stockfish engine path
chess-analyst config --engine-path /usr/local/bin/stockfish
# View current configuration
chess-analyst config --show# Start the web server
python web/app.py
# Or use the CLI command
chess-analyst serve --port 5000Then open your browser to http://localhost:5000
from chess_analyst import GameAnalyzer, PGNParser
# Load a game
parser = PGNParser("game.pgn")
game = parser.load_game()
# Analyze the game
analyzer = GameAnalyzer(engine_path="/usr/local/bin/stockfish")
analysis = analyzer.analyze(game)
# Get results
for move_analysis in analysis.moves:
print(f"Move {move_analysis.move_number}: {move_analysis.classification}")
print(f"Evaluation: {move_analysis.evaluation}")βοΈ Chess Game Analysis Report
ββββββββββββββββββββββββββββββββββββββββββββββββββ
Game Information:
White: Magnus Carlsen (2863)
Black: Hikaru Nakamura (2829)
Event: World Blitz Championship 2024
Result: 1-0
Overall Statistics:
White Accuracy: 94.2%
Black Accuracy: 87.6%
Total Moves: 42
Critical Positions: 5
Move Analysis:
β¨ Brilliant Moves: 2
β
Good Moves: 35
β οΈ Inaccuracies: 3
β Mistakes: 1
π₯ Blunders: 1
Key Moments:
Move 18: Black missed winning continuation (-3.2 β +0.5)
Move 24: White found brilliant tactical shot (+0.8 β +4.1)
Move 31: Black blunder lost the game (+2.1 β +8.4)
# Install development dependencies
pip install -r requirements-dev.txt
# Install pre-commit hooks
pre-commit install# Run all tests
pytest tests/ -v
# Run with coverage
pytest tests/ --cov=chess_analyst --cov-report=html
# Run specific test file
pytest tests/test_analyzer.py# Format code
black chess_analyst/
# Lint code
flake8 chess_analyst/
# Type checking
mypy chess_analyst/We welcome contributions! Please see our Contributing Guidelines for details.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- python-chess - Chess library for Python
- Stockfish - Powerful chess engine
- chessboard.js - JavaScript chessboard component
- The chess community for continuous inspiration
Project Maintainer: @lekhanpro
Project Link: https://github.com/lekhanpro/chess-post-game-analyst
Made with βοΈ by chess enthusiasts, for chess enthusiasts
β Star this repository if you find it helpful!