A professional chess post-game analysis tool with CLI and web interfaces
Project description
โ๏ธ Chess Post-Game Analyst
A professional, production-ready chess game analysis tool with interactive web interface
Features โข Quick Start โข Installation โข Documentation โข Contributing
๐ฏ Features
Core Analysis
- โจ 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 Web Interface
- โ๏ธ 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
Output Formats
- ๐ JSON - Machine-readable format for integration
- ๐ Text - Human-readable analysis reports
- ๐ HTML - Rich formatted reports with diagrams
- ๐ Statistics - Detailed game statistics and insights
Production Features
- ๐ณ 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
๐ Quick Start for Beginners
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
๐ Installation
Prerequisites
- Python 3.8 or higher
- Stockfish chess engine (Download Here)
Quick Install
# 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 .
Docker Installation
# Build and run with Docker Compose
docker-compose up -d
# Access web interface at http://localhost:5000
๐ก Usage
Command Line Interface
Basic Analysis
# 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
Advanced Options
# 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/
Configuration
# Set Stockfish engine path
chess-analyst config --engine-path /usr/local/bin/stockfish
# View current configuration
chess-analyst config --show
Web Interface
# Start the web server
python web/app.py
# Or use the CLI command
chess-analyst serve --port 5000
Then open your browser to http://localhost:5000
Python API
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}")
๐ Sample Output
CLI Output
โ๏ธ 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)
๐ ๏ธ Development
Setup Development Environment
# Install development dependencies
pip install -r requirements-dev.txt
# Install pre-commit hooks
pre-commit install
Running Tests
# 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
Code Quality
# Format code
black chess_analyst/
# Lint code
flake8 chess_analyst/
# Type checking
mypy chess_analyst/
๐ Documentation
๐ค Contributing
We welcome contributions! Please see our Contributing Guidelines for details.
Quick Start for Contributors
- 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
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
- python-chess - Chess library for Python
- Stockfish - Powerful chess engine
- chessboard.js - JavaScript chessboard component
- The chess community for continuous inspiration
๐ง Contact
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!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file chess_post_analyst-1.0.1.tar.gz.
File metadata
- Download URL: chess_post_analyst-1.0.1.tar.gz
- Upload date:
- Size: 22.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b30f80184d0bf91372d4957965df8531dc7173cd611f3aa2953042deea7adc0c
|
|
| MD5 |
f3d13812de9bfe89ae3c12cdb1c2c833
|
|
| BLAKE2b-256 |
c4b1c7e734a5d9310f140a2978668869d2ed4e62c518d8cc82ad3c56a37db2fa
|
File details
Details for the file chess_post_analyst-1.0.1-py3-none-any.whl.
File metadata
- Download URL: chess_post_analyst-1.0.1-py3-none-any.whl
- Upload date:
- Size: 21.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d19378a6b77994e0b7f9462c20b8f72cc6c01c9b0912248a65ca22ebe3eeebab
|
|
| MD5 |
902c6907885c3c2f5e4a173b7ad8ebbb
|
|
| BLAKE2b-256 |
7ff931d8ae9c4fcfbc735efd11b0fcd7116cb621be600c3ec3b9e18f46c4e7c1
|