A bridge between Lichess API and bots.
- NOTE: Currently, only Python3 is supported
- Download the repo into lichess-bot directory
- Navigate to the directory in cmd/Terminal:
cd lichess-bot
- Install virtualenv:
pip install virtualenv
- Setup virtualenv:
virtualenv .venv -p python3 #if this fails you probably need to add Python3 to your PATH
source .venv/bin/activate #for Windows: ./.venv/Scripts/activate
pip install -r requirements.txt
- Create your config file wih
cp config.yml.default config.yml
- Edit the variants:
supported_variants
and time controls:supported_tc
from the config.yml as necessary
- Create an account for your bot on Lichess.org
- NOTE: If you have previously played games on an existing account, you will not be able to use it as a bot account
- Once your account has been created and you are logged in, create a personal OAuth2 token with the "Play bot moves" selected and add a description
- A
token
e.g.Xb0ddNrLabc0lGK2
will be displayed. Store this inconfig.yml
as thetoken
field - NOTE: You won't see this token again on Lichess.
- Place your engine(s) in the
engine.dir
directory - In
config.yml
, enter the binary name as theengine.name
field - Leave the
weights
field empty or see LeelaChessZero section for Neural Nets
WARNING This is irreversible. Read more about upgrading to bot account.
- run
python main.py -u
- Download the weights for the id you want to play from here: http://lczero.org/networks
- Extract the weights from the zip archive and rename it to
latest.txt
- Download the lczero binary from here: https://github.com/glinscott/leela-chess/releases
- Copy both the files into the
engine.dir
directory - Change the
engine.name
andengine.weights
keys in config.yml tolczero
andlatest.txt
- You can specify the number of
engine.threads
in the config.yml file as well - To start:
python main.py
Thanks to the Lichess team, especially T. Alexander Lystad and Thibault Duplessis for working with the LeelaChessZero team to get this API up. Thanks to the Niklas Fiekas and his python-chess code which allows engine communication seamlessly.
lichess-bot is licensed under the AGPLv3 (or any later version at your option). Check out LICENSE.txt for the full text.