GithubHelp home page GithubHelp logo

al3xkras / chess-com-bot-selenium Goto Github PK

View Code? Open in Web Editor NEW
7.0 3.0 3.0 81 KB

Chess.com bot (Docker-Selenium)

Python 95.50% Batchfile 1.37% Dockerfile 1.87% Shell 1.26%
bot chess chess-com selenium-webdriver stockfish web-automation chess-bot automation docker-selenium

chess-com-bot-selenium's Introduction

chess-com-bot

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.

Setup (docker-selenium):

  1. Install Docker
  2. Build container images: docker/docker_build.bat / docker/docker_build.sh. (once / to apply changes)
  3. Run the docker-compose: docker_main.bat / docker_main.sh.
  4. Wait until Selenium containers are accessible at http://localhost:7900/ (interface: NoVNC)
  5. 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)
  6. To exit the program, run cd docker && docker-compose stop, the containers can as well be stopped from the Docker Desktop UI.

Setup on Windows

  1. 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"
  2. 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"

  3. Ensure that your Chrome version is supported by Selenium 4.17.0

  4. Run

    "./venv/Scripts/python" main.py
  5. 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
  6. To exit the program, simply close the Chrome tab, or the command prompt window.

Tested OS & Chrome version:

  • Windows 11 Version 23H2 (Build 22631.3007);
  • Chrome 121.0.6167.161 (Official Build) (64-bit) (cohort: Stable)

Disclaimer

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.

Preview:

vid.mp4

chess-com-bot-selenium's People

Contributors

al3xkras avatar astr0dev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

chess-com-bot-selenium's Issues

Move slower

Great release.

How do you make it move the pieces "slower" to appear more legitmate

Moving pieces

Sorry I couldn't find any other way to contact you
I'm making a chrome extension bot for chess.com also however im struggling to move the pieces i couldn't find the dom element that has the event listeners for clicking the piece in order to move it
I've tried all elements that have the mousedown, click (the board included)event listeners but couldn't make it
Can you explain me to me how did you move the pieces i'm not familiar with selenium
Thank you
[email protected]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.