Spaces:
Sleeping
Sleeping
TheYoBots commited on
Commit ·
ee0bbdb
1
Parent(s): d53fff6
Better logs and Readme and other updates
Browse files- README.md +9 -17
- conversation.py +1 -1
- lishogi-bot.py +6 -6
README.md
CHANGED
|
@@ -15,8 +15,8 @@ To Install, either proceed to the below steps or view steps to install [lichess
|
|
| 15 |
|
| 16 |
### Mac/Linux:
|
| 17 |
- **NOTE:** Only Python 3 is supported!
|
| 18 |
-
- Download the repo into
|
| 19 |
-
- Navigate to the directory in cmd/Terminal: `cd
|
| 20 |
- Install virtualenv: `pip install virtualenv`.
|
| 21 |
- Setup virtualenv:
|
| 22 |
|
|
@@ -25,8 +25,7 @@ To Install, either proceed to the below steps or view steps to install [lichess
|
|
| 25 |
source .venv/bin/activate
|
| 26 |
pip install -r requirements.txt
|
| 27 |
```
|
| 28 |
-
-
|
| 29 |
-
- Edit the `.yml` files to your liking, so that it plays shogi.
|
| 30 |
|
| 31 |
### Windows:
|
| 32 |
- **NOTE:** Only Python 3 is supported!
|
|
@@ -43,19 +42,18 @@ pip install -r requirements.txt
|
|
| 43 |
`./.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")
|
| 44 |
|
| 45 |
`pip install -r requirements.txt`
|
| 46 |
-
-
|
| 47 |
-
- Edit the `.yml` files to your liking, so that it plays shogi.
|
| 48 |
|
| 49 |
## Lishogi OAuth
|
| 50 |
- Create an account for your bot on [Lishogi.org](https://lishogi.org/signup).
|
| 51 |
-
- NOTE: If you have previously played games on an existing account, you will not be able to use it as a bot account.
|
| 52 |
- 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.
|
| 53 |
-
- A `token` e.g. `Xb0ddNrLabc0lGK2` will be displayed. Store this in `.yml` as the `token` field.
|
| 54 |
-
- NOTE: You won't see this token again on Lishogi.
|
| 55 |
|
| 56 |
## Setup Engine
|
| 57 |
- Place your engine(s) in the `engine.dir` directory
|
| 58 |
-
- In your `.yml` file, enter the binary name as the `engine.name` field.
|
| 59 |
- Using this process any engine can be added to the bot.
|
| 60 |
|
| 61 |
|
|
@@ -64,11 +62,5 @@ pip install -r requirements.txt
|
|
| 64 |
- run `python lishogi-bot.py -u`
|
| 65 |
- for more verbrose logs run `python lishogi-bot.py -v`
|
| 66 |
|
| 67 |
-
## To Quit Python after Upgrading to Bot Account
|
| 68 |
-
- Press `CTRL+C`.
|
| 69 |
-
- It may take some time to quit.
|
| 70 |
-
|
| 71 |
# Acknowledgements
|
| 72 |
-
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.
|
| 73 |
-
|
| 74 |
-
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.
|
|
|
|
| 15 |
|
| 16 |
### Mac/Linux:
|
| 17 |
- **NOTE:** Only Python 3 is supported!
|
| 18 |
+
- Download the repo into Lishogi-Bot directory.
|
| 19 |
+
- Navigate to the directory in cmd/Terminal: `cd Lishogi-Bot`.
|
| 20 |
- Install virtualenv: `pip install virtualenv`.
|
| 21 |
- Setup virtualenv:
|
| 22 |
|
|
|
|
| 25 |
source .venv/bin/activate
|
| 26 |
pip install -r requirements.txt
|
| 27 |
```
|
| 28 |
+
- Edit the `config.yml` file to your liking, so that it plays shogi.
|
|
|
|
| 29 |
|
| 30 |
### Windows:
|
| 31 |
- **NOTE:** Only Python 3 is supported!
|
|
|
|
| 42 |
`./.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")
|
| 43 |
|
| 44 |
`pip install -r requirements.txt`
|
| 45 |
+
- Edit the `config.yml` file to your liking, so that it plays shogi.
|
|
|
|
| 46 |
|
| 47 |
## Lishogi OAuth
|
| 48 |
- Create an account for your bot on [Lishogi.org](https://lishogi.org/signup).
|
| 49 |
+
- **NOTE:** If you have previously played games on an existing account, you will not be able to use it as a bot account.
|
| 50 |
- 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.
|
| 51 |
+
- A `token` e.g. `Xb0ddNrLabc0lGK2` will be displayed. Store this in `config.yml` as the `token` field.
|
| 52 |
+
- **NOTE:** You won't see this token again on Lishogi.
|
| 53 |
|
| 54 |
## Setup Engine
|
| 55 |
- Place your engine(s) in the `engine.dir` directory
|
| 56 |
+
- In your `config.yml` file, enter the binary name as the `engine.name` field.
|
| 57 |
- Using this process any engine can be added to the bot.
|
| 58 |
|
| 59 |
|
|
|
|
| 62 |
- run `python lishogi-bot.py -u`
|
| 63 |
- for more verbrose logs run `python lishogi-bot.py -v`
|
| 64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
# Acknowledgements
|
| 66 |
+
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 and for running an [API](https://lichess.org/api) which is used by lishogi. Thanks to the [Tasuku SUENAGA a.k.a. gunyarakun](https://github.com/gunyarakun) and his [python-shogi](https://github.com/gunyarakun) code which allows engine communication seamlessly. And lastly, Thanks to [WandererXII](https://github.com/WandererXII) for all his effort and [help](https://github.com/WandererXII/lishogi-bot).
|
|
|
|
|
|
conversation.py
CHANGED
|
@@ -20,7 +20,7 @@ class Conversation:
|
|
| 20 |
game.ping(60, 120)
|
| 21 |
self.send_reply(line, "Waiting 60 seconds...")
|
| 22 |
elif cmd == "name":
|
| 23 |
-
self.send_reply(line, "
|
| 24 |
elif cmd == "howto":
|
| 25 |
self.send_reply(line, "How to run your own bot: https://github.com/TheYoBots/Lishogi-Bot")
|
| 26 |
elif cmd == "eval" and line.room == "spectator":
|
|
|
|
| 20 |
game.ping(60, 120)
|
| 21 |
self.send_reply(line, "Waiting 60 seconds...")
|
| 22 |
elif cmd == "name":
|
| 23 |
+
self.send_reply(line, "lishogi-bot v0.2.0")
|
| 24 |
elif cmd == "howto":
|
| 25 |
self.send_reply(line, "How to run your own bot: https://github.com/TheYoBots/Lishogi-Bot")
|
| 26 |
elif cmd == "eval" and line.room == "spectator":
|
lishogi-bot.py
CHANGED
|
@@ -30,7 +30,7 @@ try:
|
|
| 30 |
except ImportError:
|
| 31 |
from http.client import BadStatusLine as RemoteDisconnected
|
| 32 |
|
| 33 |
-
__version__ = "
|
| 34 |
|
| 35 |
terminated = False
|
| 36 |
|
|
@@ -332,11 +332,11 @@ def update_board(board, move):
|
|
| 332 |
|
| 333 |
def intro():
|
| 334 |
return r"""
|
| 335 |
-
. _/
|
| 336 |
-
. // o\
|
| 337 |
-
. ||
|
| 338 |
-
.
|
| 339 |
-
.
|
| 340 |
""" % __version__
|
| 341 |
|
| 342 |
if __name__ == "__main__":
|
|
|
|
| 30 |
except ImportError:
|
| 31 |
from http.client import BadStatusLine as RemoteDisconnected
|
| 32 |
|
| 33 |
+
__version__ = "0.2.0"
|
| 34 |
|
| 35 |
terminated = False
|
| 36 |
|
|
|
|
| 332 |
|
| 333 |
def intro():
|
| 334 |
return r"""
|
| 335 |
+
. _/\_
|
| 336 |
+
. //o o\\
|
| 337 |
+
. || || lishogi-bot v0.2.0
|
| 338 |
+
. || ||
|
| 339 |
+
. ||____|| Play on Lishogi with a bot
|
| 340 |
""" % __version__
|
| 341 |
|
| 342 |
if __name__ == "__main__":
|