Skip to content

thetrueartist/chess.comAssistant

Repository files navigation

Chess.com Assistant ♟️👁️🤖

A smart chess bot that combines computer vision and AI to show you the best chess moves in real-time on Chess.com

Features ✨

  • 🖥️ Screen Analysis: Automatically detects chessboard position using OpenCV + PyTorch Vision

  • 🤖 ML Chess Engine Integration With Stockfish: Powered by Stockfish engine with dynamic difficulty adjustment (0-20 skill levels)

  • 🕵️ Anti-Detection System:

    • Randomized move timing patterns
    • Human-like move selection variance
    • Dynamic skill adjustment
  • 🧠 Smart Game Analysis:

    • Real-time FEN position recognition
    • Automatic game phase detection (opening/middlegame/endgame)
    • Adaptive thinking time based on position complexity
  • 📊 Performance Monitoring:

    • CPU/Memory usage tracking
    • Detailed error logging
    • Move validation system
  • ♟️ Game Features:

    • Supports both white and black pieces
    • Win condition detection
    • Multi-game session support

How It Works 🔧

  1. Computer Vision Pipeline:

    • Screenshot capture with pyscreenshot
    • Chessboard detection using OpenCV contour analysis
    • Piece recognition with ResNet50 deep learning model
    • Perspective transformation for board alignment
  2. AI Engine:

    • Stockfish integration with optimized parameters
    • Dynamic depth adjustment (15-30 plies)
    • Position complexity analysis using move entropy
    • Multi-variant move selection with weighted randomness
  3. Anti-Detection System:

    • Randomized delay patterns (0.1-2.5s)
    • Skill level variability during gameplay
    • Natural move timing based on position complexity

Requirements 📦

Python 3.8+
Stockfish 15+ (path configuration required)
torch
torchvision
opencv-python
pyscreenshot
python-chess
psutil

Installation 🛠️

pip install opencv-python numpy pyscreenshot torch torchvision python-chess psutil pillow

(you might need to use --break-system-packages on newer versions of linux for that pip command)

sudo apt-get install stockfish  # Debian/Ubuntu
brew install stockfish          # MacOS

Or for Windows download the latest version of stockfish here: https://stockfishchess.org/download/

(I may add in auto downloading of stockfish on windows at some point)

NOTES 🗒️

NOW WITH WINDOWS SUPPORT!

:)

chessAssistantWindows

Chess.com Assistant is ideally used with the terminal on the right half of your screen and the chess.com window on the left half. It additionally only works on the default Chess.com theme.

It works best at 1440p resolution. chessAssistantLinux

WORK IN PROGRESS, A LITTLE BUGGY :p

About

Automated Chess.com Assistant

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages