Skip to content

A unified toolset for chess botting on Chess.com, featuring a Flask-based API server and a custom UserScript extension.

License

Notifications You must be signed in to change notification settings

Violevo/Chess-Bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chess Botting Tool

A unified toolset for chess botting on chess sites, featuring a Flask-based API server and a custom UserScript extension.

Features

Python API Server (server.py)

A backend server that interfaces with the LC0 engine to provide move suggestions based on various Maia models, supports:

  • Multi-Model support (weights/ folder)
  • Dynamic engine loading with specific weights.
  • Multi-PV (Principal Variation) analysis.
  • Configurable nodes for search depth.

Browser Extension (extension.js)

A UserScript (Tampermonkey/Violentmonkey) that integrates directly into the Chess.com interface, adding:

  • Control Panel: A side panel to select models, adjust nodes, and adjust settings.
  • Visualise Moves: Highlights best moves with configurable arrows or boxes.
  • Tab Status: Displays the best 3 moves (and model info) in the tab title.
  • Automation:
    • Auto-Analyze: Automatically fetches the best move after every turn.
    • Auto-Move: Automatically plays the suggested move (configurable delay).
    • Auto-Queue: Automatically starts a new game.
  • Game History: Keeps a local record of your games and results.

Overview

A client-server model where the browser extension communicates with a local Python backend via REST API. Utilising the Chess.com UI for board scraping and move visualization.

  • LC0: High-performance chess engine (Leela Chess Zero) utilizing dynamic neural network weights for move predictions.
  • Maia Chess: Neural network chess engine weights trained to play chess more like humans, offering models between 1100-1900 Elo.
  • Flask: A lightweight Python web framework used to host the engine and handle move requests.

Setup

Clone the repository (or just download the zip and extract):

git clone https://github.com/Violevo/Chess-Bot
cd Chess-Bot

Python API Server (server.py)

  1. Virtual Environment: Create a virtual environment and activate it.

    python -m venv .venv
    .\.venv\Scripts\Activate.ps1
    pip install -r requirements.txt
  2. Engine Dependencies: Ensure lc0/lc0.exe and its required DLLs (onnxruntime.dll, etc.) are in the lc0/ folder. You can find them here

  3. Weights: Place any .pb.gz weights in the weights/ folder. For example, Maia Chess weights can be found here

  4. Run the program: You can either run the program using

    .\.venv\Scripts\python server.py

    or

    .\.venv\Scripts\pythonw server.py # Headless mode

    These scripts are also provided in the repository as start_headless.bat and start.bat respectivley.

Browser Extension (extension.js)

  1. Install a UserScript manager (e.g., Tampermonkey).
  2. Create a new script and paste in the contents of extension.js.
  3. Ensure the API URL in the extension settings matches your server (default: http://localhost:5000/move).

Contributing & Licensing

Contributions, suggestions, and bug reports are always welcome. If you'd like to contribute to this project, please fork the repository, create a feature branch, and submit a pull request.

This project is licensed under the GNU General Public License v3.0 License - see the LICENSE file for more details.

Gallery

Menu Tab Status

About

A unified toolset for chess botting on Chess.com, featuring a Flask-based API server and a custom UserScript extension.

Topics

Resources

License

Stars

Watchers

Forks