A Chess.com bot based on the Selenium WebDriver for browser automation and the Stockfish chess engine for position evaluation.
Features:
- Fully configurable (using command line arguments or docker-compose, see the list of available configurations below).
- Fast response speed (minimum latency of about 100-150ms added to the Stockfish thinking time). Custom delays configurable.
- Low resource usage (Docker-based build).
- Cross-platform (supported on Linux, Docker and Windows). Most linux distributions (debian/ubuntu) should be supported but may require additional setup. Check out the Dockerfile (ubuntu-based) for more insight. Also make sure there exists a Stockfish build for your distribution, at the Stockfish repo
- The bot can work autonomously after the first game is started manually.
- The bot closes most of the pop-up windows automatically.
- The bot handles network/chess.com-related bugs and should continue to work if any occur.
-
Install Docker and Docker compose.
-
Run containers using the Docker compose:
docker_main.bat/docker_main.sh.List of configurable docker-compose properties
docker/docker-compose.yml:elo_rating- engine's ELO rating (default value:-1)game_timer_ms- game timer in milliseconds (default value:150000)first_move_w- initial move when playing white pieces (default value:"e2e4")enable_move_delay- enable delay between moves (default value:False)next_game_auto- start the next game automatically (default value:True)
-
Wait until a Chrome NoVNC session is loaded at http://localhost:7901/
-
To check if the bot is working properly, start the first game manually and wait until the first move is made.
-
To exit the program, run
cd docker && docker compose stop, or stop the containers from the Docker Desktop UI.
-
Create a virtual environment:
git clone --depth 1 https://github.com/al3xkras/chess-com-bot-selenium chess-com-bot cd ./chess-com-bot
pip install virtualenv && virtualenv venv"venv/Scripts/pip" install -r "requirements.txt"
-
Choose a compatible Stockfish release at the Stockfish repo.
Example: https://github.com/official-stockfish/Stockfish/releases/tag/sf_16.1 .
-
Unzip the stockfish executable into the ./stockfish/ directory. Rename the executable to "stockfish.exe" or "stockfish"
-
Run the bot using the command line:
"./venv/Scripts/python" main.pyList of configurable command line arguments:
--elo-rating- engine's ELO rating (default value:-1)--game-timer-ms- game timer in milliseconds (default value:150000)--first-move-w- initial move when playing white pieces (default value:"e2e4")--enable-move-delay- enable delay between moves (default value:False)--next-game-auto- start the next game automatically (default value:True)--help- list all available options
- Windows 11 Version 23H2 (Build 22631.3007);
- Chrome 121.0.6167.161 (Official Build) (64-bit) (cohort: Stable)
The software is provided as-is, without warranties of any kind. The author is not responsible for any adverse effects, including but not limited to account bans, resulting from the use of this bot.