A Chess.com bot based on the Stockfish chess engine and the Selenium WebDriver.
-
Engine's ELO rating, and other properties can be modified in the command line arguments.
-
Supported on any platform that can run Docker/Docker-Selenium and on Windows.
- Install Docker
- Build container images:
docker/docker_build.bat/docker/docker_build.sh. (once / to apply changes) - Run the docker-compose:
docker_main.bat/docker_main.sh. - Wait until Selenium containers are accessible at http://localhost:7900/ (interface: NoVNC)
- Optional properties that can be modified in
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)
- To exit the program, run
cd docker && docker-compose stop, the containers can as well be stopped 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 (https://github.com/official-stockfish/Stockfish/releases). Unzip the contents into the ./stockfish/ directory of the project path. The executable should be renamed to "stockfish.exe"
-
Ensure that your Chrome version is supported by Selenium 4.17.0
-
Run
"./venv/Scripts/python" main.py -
Optional 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
-
To exit the program, simply close the Chrome tab, or the command prompt window.
- 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.