A bridge between Lichess API and Lishogi USI Bots. In case you don't know English, view the Japanese Translation here (日本語翻訳).
- NOTE: Only Python 3.7 or later is supported!
- Download the repo into Lishogi-Bot directory.
- Navigate to the directory in cmd/Terminal:
cd Lishogi-Bot
. - Install pip:
apt install python3-pip
- Install virtualenv:
pip install virtualenv
. - Setup virtualenv:
apt install python3-venv
python3 -m venv venv (if this fails you probably need to add Python3 to your PATH)
virtualenv .venv -p python3 (if this fails you probably need to add Python3 to your PATH)
source ./venv/bin/activate
python3 -m pip install -r requirements.txt
- Edit the
config.yml
file to your liking by changing the supported variants, timings, challenge modes and incoming challenges, so that it plays shogi.
- NOTE: Only Python 3.7 or later is supported!
- If you don't have Python, you may download it here. 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 (especiallyinstall for all users
), except the last . It's better to install Python in a path without spaces, likeC:\Python\
. - To type commands it's better to use PowerShell. Go to Start menu and type
PowerShell
. - Then you may need to upgrade pip. Execute
python -m pip install --upgrade pip
in PowerShell. - Download the repo into lishogi-bot directory.
- Navigate to the directory in PowerShell:
cd [folder's adress]
(likecd C:\shogi\lishogi-bot
). - Install virtualenv:
pip install virtualenv
. - Setup virtualenv:
virtualenv .venv -p python
(if this fails you probably need to add Python to your PATH)
./.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")
pip install -r requirements.txt
- Edit the
config.yml
file to your liking by changing the supported variants, timings, challenge modes and incoming challenges, so that it plays shogi.
- Create an account for your bot on Lishogi.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 as a bot" selected and add a description.
- A
token
e.g.xxxxxxxxxxxxxxxx
will be displayed. Store this inconfig.yml
as thetoken
field. - NOTE: You won't see this token again on Lishogi, so save it or store it somewhere.
- Place your engine(s) in the
engine.dir
directory - In your
config.yml
file, enter the binary name as theengine.name
field. - Using this process any engine can be added to the bot.
- Note: The engine you add has to be running under the USI protocol, then only it will work
WARNING This is irreversible. Read more about upgrading to bot account.
- run
python lishogi-bot.py -u
- for more verbrose logs run
python lishogi-bot.py -v
Thanks to the Lichess Team for creating a repository that could be easily accessed and modified to help converting it to a format that supports Lishogi and for running an API which is used by lishogi. Thanks to the Tasuku SUENAGA a.k.a. gunyarakun and his python-shogi code which allows engine communication seamlessly. Thanks to allthatglittersisgold for creating a Windows executable for lishogi-bot.py
and Thanks to WandererXII for all his effort and help.