GithubHelp home page GithubHelp logo

lichess-bot's Introduction

lichess-bot

This is a bot for lichess. It interacts with the site through a JavaScript proxy that talks to a localhost WebSocket server written in Python that talks to a Stockfish process.

Usage

You need Python and Stockfish installed. Make sure Stockfish is in your $PATH. Run the websocket server:

python server.py

Next, install hook.js onto the game page using Greasemonkey or userscripts or whatever. Just install it onto en.lichess.org/*. Alternatively, a little hack you can use if you just want to test out lichess-bot is to run this one-line Bash web-server:

while true; do { echo -e 'HTTP/1.1 200 OK\r\n'; cat hook.js; } | nc -l 8080; done

and then everytime you enter a game, open your browser's JavaScript console and run:

var script = document.createElement('script');

script.setAttribute('src', 'http://localhost:8080/');
document.head.appendChild(script);

to dynamically load the script onto the page.

Once you've done all that, you should see Stockfish making moves for you. If it ever stops, it's probably because the other player moved so fast the script didn't get a chance to see that a turn passed (that's how it knows when to ask the websocket server for another move). Just reload the script if that happens.

Notes

You should never lose unless you run into another computer. Stockfish's rating is over 3,000.

I set Stockfish to favor aggressiveness because I like fast games. I use four threads, but you should change that to the number of cores your processor has. You can change these things (and a few other settings) in server.py under Engine.__init__.

lichess-bot's People

Watchers

 avatar  avatar

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.