Skip to content

♟️ An AI-powered chess commentator that analyzes live gameplay and generates real-time, natural language commentary. Built with modular and maintainable architecture to showcase clean code practices in AI and game analysis.

License

Notifications You must be signed in to change notification settings

jayanth9844/Ai-Commentator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

♟️ AI Commentator for Chess


🎯 Project Overview

AI Commentator is an intelligent, offline-compatible chess analysis system that generates real-time, human-like commentary for chess moves. It integrates the Stockfish 16 chess engine, a feature extraction pipeline, and a fine-tuned GPT-2 transformer model to provide insightful and educational move analysis. Commentary is delivered both as on-screen text and via speech using pyttsx3.


📽️ Demo Video

(click here to view 👉) Watch the demo


🖼️ Key Visuals

System Architecture
Model Loss Curve
GUI Interface with Commentary

🔍 Problem Statement

While expert chess engines provide high-quality evaluations, they lack the clarity and accessibility required by beginners or casual users. Most tools also require online access. This system addresses that gap by providing:

  • 🧠 Natural language explanations for every move
  • 🔌 Offline functionality for resource-constrained environments
  • 📚 An immersive and educational gameplay experience

🚀 Features

  • 🧠 Real-time move evaluation using Stockfish 16
  • 🗣️ Natural language commentary using fine-tuned GPT-2
  • 🔊 Offline Text-to-Speech via pyttsx3
  • 📦 Fully modular & offline-compatible (no internet needed)
  • 🎮 Interactive GUI built with Pygame

🔧 Tech Stack

Component Tool/Library
Chess Engine Stockfish 16
GUI & Game Logic pygame, python-chess
NLP Model GPT-2
Feature Extraction Custom pipeline on FEN strings
TTS (Speech) pyttsx3 (offline)
Data Source Lichess.org

📐 System Architecture

flowchart TD
  subgraph GUI [User Interface]
    A[Pygame Chess Board]
    I[Display Commentary and Evaluation]
  end

  subgraph Engine [Analysis and Generation]
    B[Board State using python-chess]
    C[Stockfish 16 Engine Analysis]
    D[Formatted Analysis String]
    E[GPT-2 Medium - 355M Parameters]
    F[Generated Commentary]
  end

  subgraph Output [Output]
    G[pyttsx3 Text-to-Speech]
    H[Audio Commentary]
  end

  A --> B
  B --> C
  C --> D
  C --> I
  D --> E
  E --> F
  F --> G
  F --> I
  G --> H
Loading

📦 How to Run the Project

🗂️ Download Instructions

To get started quickly:

👉 Download only the game_folder/ from the repository:
🔗 github.com/jayanth9844/Ai-Commentator

🚀 Run the Application

Once you've downloaded the folder:

# Step into the game folder
cd game_folder

# Run the interface
python interface_buil.py

About

♟️ An AI-powered chess commentator that analyzes live gameplay and generates real-time, natural language commentary. Built with modular and maintainable architecture to showcase clean code practices in AI and game analysis.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages