Spaces:
Sleeping
Sleeping
TheYoBots commited on
Commit ·
3084fc8
1
Parent(s): 36a76bb
Update ReadMe to Lishogi
Browse files
README.md
CHANGED
|
@@ -1,104 +1,28 @@
|
|
| 1 |
-
#
|
| 2 |
-
A bridge between [Lichess API](https://lichess.org/api#tag/Chess-Bot) and
|
| 3 |
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
-
|
| 9 |
-
-
|
| 10 |
-
- Navigate to the directory in cmd/Terminal: `cd lichess-bot`
|
| 11 |
-
- Install virtualenv: `pip install virtualenv`
|
| 12 |
-
- Setup virtualenv:
|
| 13 |
-
```
|
| 14 |
-
virtualenv .venv -p python3 #if this fails you probably need to add Python3 to your PATH
|
| 15 |
-
source .venv/bin/activate
|
| 16 |
-
pip install -r requirements.txt
|
| 17 |
-
```
|
| 18 |
-
- Copy `config.yml.default` to `config.yml`
|
| 19 |
-
- Edit the variants: `supported_variants` and time controls: `supported_tc` from the config.yml as necessary
|
| 20 |
-
|
| 21 |
-
### Windows:
|
| 22 |
-
- Here is a video on how to install the bot: (https://youtu.be/w-aJFk00POQ). Or you may proceed to the next steps.
|
| 23 |
-
- NOTE: Only Python 3 is supported!
|
| 24 |
-
- If you don't have Python, you may download it here: (https://www.python.org/downloads/). When installing it, enable "add Python to PATH", then go to custom installation (this may be not necessary, but on some computers it won't work otherwise) and enable all options (especially "install for all users"), except the last . It's better to install Python in a path without spaces, like "C:\Python\".
|
| 25 |
-
- To type commands it's better to use PowerShell. Go to Start menu and type "PowerShell" (you may use cmd too, but sometimes it may not work).
|
| 26 |
-
- Then you may need to upgrade pip. Execute "python -m pip install --upgrade pip" in PowerShell.
|
| 27 |
-
- Download the repo into lichess-bot directory.
|
| 28 |
-
- Navigate to the directory in PowerShell: `cd [folder's adress]` (like "cd C:\chess\lichess-bot").
|
| 29 |
-
- Install virtualenv: `pip install virtualenv`.
|
| 30 |
-
- Setup virtualenv:
|
| 31 |
-
```
|
| 32 |
-
virtualenv .venv -p python (if this fails you probably need to add Python to your PATH)
|
| 33 |
-
./.venv/Scripts/activate (.\.venv\Scripts\activate should work in cmd in administator mode) (This may not work on Windows, and in this case you need to execute "Set-ExecutionPolicy RemoteSigned" first and choose "Y" there [you may need to run Powershell as administrator]. After you executed the script, change execution policy back with "Set-ExecutionPolicy Restricted" and pressing "Y")
|
| 34 |
-
pip install -r requirements.txt
|
| 35 |
-
```
|
| 36 |
-
- Copy `config.yml.default` to `config.yml`
|
| 37 |
-
- Edit the variants: `supported_variants` and time controls: `supported_tc` from the config.yml as necessary (use # to disable certain ones)
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
## Lichess OAuth
|
| 41 |
-
- Create an account for your bot on [Lichess.org](https://lichess.org/signup)
|
| 42 |
-
- NOTE: If you have previously played games on an existing account, you will not be able to use it as a bot account
|
| 43 |
-
- Once your account has been created and you are logged in, [create a personal OAuth2 token](https://lichess.org/account/oauth/token/create) with the "Play as a bot" selected and add a description
|
| 44 |
-
- A `token` e.g. `Xb0ddNrLabc0lGK2` will be displayed. Store this in `config.yml` as the `token` field
|
| 45 |
-
- NOTE: You won't see this token again on Lichess.
|
| 46 |
|
| 47 |
|
| 48 |
## Setup Engine
|
| 49 |
- Place your engine(s) in the `engine.dir` directory
|
| 50 |
-
- In `
|
| 51 |
-
- Leave the `weights` field empty or see LeelaChessZero section for Neural Nets
|
| 52 |
|
| 53 |
|
| 54 |
-
##
|
| 55 |
**WARNING** This is irreversible. [Read more about upgrading to bot account](https://lichess.org/api#operation/botAccountUpgrade).
|
| 56 |
- run `python lichess-bot.py -u`
|
| 57 |
|
| 58 |
## To Quit
|
| 59 |
-
- Press CTRL+C
|
| 60 |
-
- It may take some time to quit
|
| 61 |
-
|
| 62 |
-
## LeelaChessZero
|
| 63 |
-
|
| 64 |
-
- Download the weights for the id you want to play from here: http://lczero.org/networks
|
| 65 |
-
- Extract the weights from the zip archive and rename it to `latest.txt`
|
| 66 |
-
- For Windows, download the lczero binary from https://github.com/glinscott/leela-chess/releases
|
| 67 |
-
- For Mac/Linux, build the lczero binary yourself following [LeelaChessZero/lc0/README](https://github.com/LeelaChessZero/lc0/blob/master/README.md)
|
| 68 |
-
- Copy both the files into the `engine.dir` directory
|
| 69 |
-
- Change the `engine.name` and `engine.engine_options.weights` keys in config.yml to `lczero` (`lczero.exe` for Windows) and `weights.pb.gz`
|
| 70 |
-
- You can specify the number of `engine.uci_options.threads` in the config.yml file as well
|
| 71 |
-
- To start: `python lichess-bot.py`
|
| 72 |
-
|
| 73 |
-
## For Docker
|
| 74 |
-
|
| 75 |
-
Use https://github.com/vochicong/lc0-nvidia-docker to easily run lc0 and lichess-bot
|
| 76 |
-
inside a Docker container.
|
| 77 |
-
|
| 78 |
-
## Tips & Tricks
|
| 79 |
-
- You can specify a different config file with the `--config` argument.
|
| 80 |
-
- Here's an example systemd service definition:
|
| 81 |
-
```
|
| 82 |
-
[Unit]
|
| 83 |
-
Description=lichess-bot
|
| 84 |
-
After=network-online.target
|
| 85 |
-
Wants=network-online.target
|
| 86 |
-
|
| 87 |
-
[Service]
|
| 88 |
-
Environment="PYTHONUNBUFFERED=1"
|
| 89 |
-
ExecStart=/usr/bin/python3 /home/thibault/lichess-bot/lichess-bot.py
|
| 90 |
-
WorkingDirectory=/home/thibault/lichess-bot/
|
| 91 |
-
User=thibault
|
| 92 |
-
Group=thibault
|
| 93 |
-
Restart=always
|
| 94 |
-
|
| 95 |
-
[Install]
|
| 96 |
-
WantedBy=multi-user.target
|
| 97 |
-
```
|
| 98 |
|
| 99 |
# Acknowledgements
|
| 100 |
-
Thanks to the Lichess
|
| 101 |
-
team to get this API up. Thanks to the Niklas Fiekas and his [python-chess](https://github.com/niklasf/python-chess) code which allows engine communication seamlessly.
|
| 102 |
|
| 103 |
-
|
| 104 |
-
lichess-bot is licensed under the AGPLv3 (or any later version at your option). Check out LICENSE.txt for the full text.
|
|
|
|
| 1 |
+
# Lishogi-Bot
|
| 2 |
+
A bridge between [Lichess API](https://lichess.org/api#tag/Chess-Bot) and Lishogi Bots.
|
| 3 |
|
| 4 |
+
## Lishogi OAuth
|
| 5 |
+
- Create an account for your bot on [Lishogi.org](https://lishogi.org/signup).
|
| 6 |
+
- NOTE: If you have previously played games on an existing account, you will not be able to use it as a bot account.
|
| 7 |
+
- Once your account has been created and you are logged in, [create a personal OAuth2 token](https://lishogi.org/account/oauth/token/create) with the "Play as a bot" selected and add a description.
|
| 8 |
+
- A `token` e.g. `Xb0ddNrLabc0lGK2` will be displayed. Store this in `.yml` as the `token` field.
|
| 9 |
+
- NOTE: You won't see this token again on Lishogi.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
|
| 12 |
## Setup Engine
|
| 13 |
- Place your engine(s) in the `engine.dir` directory
|
| 14 |
+
- In your `.yml` file, enter the binary name as the `engine.name` field.
|
|
|
|
| 15 |
|
| 16 |
|
| 17 |
+
## Lishogi Upgrade to Bot Account
|
| 18 |
**WARNING** This is irreversible. [Read more about upgrading to bot account](https://lichess.org/api#operation/botAccountUpgrade).
|
| 19 |
- run `python lichess-bot.py -u`
|
| 20 |
|
| 21 |
## To Quit
|
| 22 |
+
- Press `CTRL+C`.
|
| 23 |
+
- It may take some time to quit.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
# Acknowledgements
|
| 26 |
+
Thanks to the Lichess Team for creating a [repository](https://github.com/ShailChoksi/lichess-bot) that could be easily accessed and modified to help converting it to a format that supports Lishogi.
|
|
|
|
| 27 |
|
| 28 |
+
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](https://github.com/niklasf/python-chess) code which allows engine communication seamlessly.
|
|
|