Logo
Chess Analyzer Pro
ReleasesDocsBlogDownload

Documentation

Getting StartedUsage GuideConfigurationArchitectureFiles & DataTroubleshootingHow We Calculate AnalysisChangelogFor Developers

Chess Analyzer Pro

Professional local-first chess analysis.

Project

  • GitHub Repository
  • Download
  • Documentation
  • Report Feedback/Bug

Resources

  • Stockfish Engine
  • Beekeeper Studio
  • My Lichess Profile
  • My Chess.com Profile

Developer

  • Portfolio
  • GitHub Profile
  • LinkedIn
  • Contact Me
Ā© 2025 Utkarsh Tiwari. Open Source.

Architecture & Data Flow

Chess Analyzer Pro follows a Model-View-Controller (MVC) oriented architecture to ensure separation of concerns between the chess logic, the user interface, and the data management.

High-Level Pattern

  1. Model (Backend): Handles the core logic and data state.
    • State: GameAnalysis objects hold moves, evaluation scores, and metadata.
    • Computation: The Analyzer class manages the heavy lifting of communicating with Stockfish.
  2. View (GUI): Displays the data to the user.
    • PyQt6: The entire UI is built using the Qt framework.
    • Components: BoardWidget (Visual Board), AnalysisPanel (Stats/Graphs), MoveList.
  3. Controller (Logic): Orchestrates the application.
    • Signals & Slots: The robust event system in Qt connects UI actions (like clicking "Next Move") to backend functions (like "Load Board State").

Key Components

Backend (src/backend/)

ComponentResponsibility
analyzer.pyThe Brain. Manages the analysis queue, calculates Win Probability Loss (WPL), determines move classifications (Brilliant, Blunder, etc.), and updates the game state.
engine.pyStockfish Bridge. Wraps the Stockfish process using python-chess. Handles UCI protocol commands (position, go, stop) and parses engine output.
models.pyData Types. functions as the single source of truth for data structures like GameAnalysis, MoveAnalysis, and FenData.
pgn_parser.pyData Ingestion. robust parsing of .pgn files to extract moves, headers, and comments into a usable format.

GUI (src/gui/)

ComponentResponsibility
main_window.pyRoot Container. Initializes the application window, sidebar, and main layout. Routes global events.
analysis_view.pyDashboard. The central hub displaying the board, stats, graphs, and move list side-by-side.
board_widget.pyVisuals. Renders the chess board, pieces, arrows (for best moves), and highlights (last move, check).
graph_widget.pyVisualization. Uses matplotlib to draw the evaluation curve, allowing users to visualize the momentum of the game.

Data Flow Example: Analysis Loop

  1. User Action: User clicks "Analyze Game".
  2. Controller: MainWindow emits a signal to the Analyzer worker thread.
  3. Backend Processing:
    • Analyzer iterates through every move in the GameAnalysis object.
    • For each position, it sends the FEN to engine.py.
    • engine.py queries Stockfish and returns the evaluation (Centipawns/Mate).
    • Analyzer calculates win probability and classifies the move (e.g., "Best Move").
  4. UI Update:
    • Analyzer emits a progress_update signal.
    • AnalysisPanel catches this signal and updates the progress bar and current stats in real-time.

architechture