torom / botli Goto Github PK
View Code? Open in Web Editor NEWLichess Bot
License: GNU Affero General Public License v3.0
Lichess Bot
License: GNU Affero General Public License v3.0
Please look at my Config.yml file, I reduced but still got this:
2022-08-08T04:58:04.505955+00:00 heroku[worker.1]: Process running mem=531M(103.8%)
2022-08-08T04:58:04.509167+00:00 heroku[worker.1]: Error R14 (Memory quota exceeded)
2022-08-08T04:58:28.906497+00:00 heroku[worker.1]: Process running mem=532M(103.9%)
2022-08-08T04:58:28.917599+00:00 heroku[worker.1]: Error R14 (Memory quota exceeded)
Today my bot played 105 games but after that it show 429 Client Error: Too Many Requests for url: https://lichess.org/api/challenge/Stobot and not challenging why? How to fix? Also before it showed 429 Client Error: Too Many Requests for url: https://lichess.org/api/challenge/ResoluteBot
Hey author,
Please tell me how to use NNUE on the bot please
Thank you
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\Python310\lib\threading.py", line 1016, in _bootstrap_inner
self.run()
File "C:\Users\olymp\Downloads\BotLi-main\game.py", line 63, in run
uci_move, offer_draw, resign = self.lichess_game.make_move()
File "C:\Users\olymp\Downloads\BotLi-main\lichess_game.py", line 77, in make_move
elif response := self._make_egtb_move():
File "C:\Users\olymp\Downloads\BotLi-main\lichess_game.py", line 566, in _make_egtb_move
if response := self.api.get_egtb(self.board.fen(), variant, timeout):
File "C:\Users\olymp\Downloads\BotLi-main\api.py", line 109, in get_egtb
response = self.session.get(
File "C:\Users\olymp\AppData\Roaming\Python\Python310\site-packages\requests\sessions.py", line 600, in get
return self.request("GET", url, **kwargs)
File "C:\Users\olymp\AppData\Roaming\Python\Python310\site-packages\requests\sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\olymp\AppData\Roaming\Python\Python310\site-packages\requests\sessions.py", line 701, in send
r = adapter.send(request, **kwargs)
File "C:\Users\olymp\AppData\Roaming\Python\Python310\site-packages\requests\adapters.py", line 565, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='tablebase.lichess.ovh', port=443): Max retries exceeded with url: /standard?fen=8%2F8%2F6B1%2F6P1%2F1k6%2F1pp1b3%2F8%2F1K6+b+-+-+0+55 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000001B8F22BB4F0>: Failed to establish a new connection: [Errno 11002] getaddrinfo failed'))
Uh Hi, @Torom
In 25/Aug/22 when on Heroku web, I saw this:
Umm I am wondering if there is another way to use "BotLi" on other cloud servers
Because this is a Long Term plans from Heroku, so I guess you should do something with this repo in order to make it usable on other cloud services.
Best regards,
I really want the bot to support all lichess variants.
Do you have an idea for how to do it ?
Describe the bug
After installing BotLi does not work
To Reproduce
Steps to reproduce the behavior:
pi@raspberrypi4:~/Chess/BotLi $ python user_interface.py
Traceback (most recent call last):
File "/home/pi/Chess/BotLi/user_interface.py", line 5, in
from api import API
File "/home/pi/Chess/BotLi/api.py", line 9, in
from api_challenge_response import API_Challenge_Reponse
File "/home/pi/Chess/BotLi/api_challenge_response.py", line 7, in
class API_Challenge_Reponse:
File "/home/pi/Chess/BotLi/api_challenge_response.py", line 8, in API_Challenge_Reponse
challenge_id: Challenge_ID | None = None
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'
Information:
Config:
token: "token is removed" # Lichess OAuth2 Token.
engine: # Engine settings.
dir: "./engines" # Directory containing the engine.
name: "stockfish" # Binary name of the engine to use.
ponder: true # Think on opponent's time.
silence_stderr: false # Suppresses stderr output.
syzygy:
enabled: false # Activate local syzygy endgame tablebases.
paths: # Paths to local syzygy endgame tablebases.
- "/path/to/syzygy"
max_pieces: 6 # Count of max pieces in the local syzygy endgame tablebases.
instant_play: true # Whether the bot should play directly from syzygy without engine if possible.
gaviota:
enabled: false # Activate local gaviota endgame tablebases.
paths: # Paths to local gaviota endgame tablebases.
- "/path/to/gaviota"
max_pieces: 5 # Count of max pieces in the local gaviota endgame tablebases.
uci_options: # Arbitrary UCI options passed to the engine. (Commenting allowed)
Move Overhead: 100 # Increase if your bot flags games too often.
Threads: 4 # Max CPU threads the engine can use.
Hash: 256 # Max memory (in megabytes) the engine can allocate.
variants:
enabled: false # Activate seperate engine for other chess variants than standard and chess960.
dir: "./engines" # Directory containing the engine.
name: "fairy-stockfish" # Binary name of the engine to use.
ponder: true # Think on opponent's time.
silence_stderr: false # Suppresses stderr output.
uci_options: # Arbitrary UCI options passed to the engine. (Commenting allowed)
Move Overhead: 100 # Increase if your bot flags games too often.
Threads: 4 # Max CPU threads the engine can use.
Hash: 256 # Max memory (in megabytes) the engine can allocate.
opening_books:
enabled: false # Activate opening books.
books:
# white: # List of names of books to use as white.
# - "WhiteBook"
# black: # List of names of books to use as black.
# - "BlackBook"
standard: # List of names of books to use if there is no specific book for white, black or chess960.
- "DefaultBook"
# chess960: # List of names of books to use for chess960.
# - "Chess960Book"
# Use the same pattern for 'antichess', 'atomic', 'crazyhouse', 'horde', 'kingofthehill', 'racingkings' and '3check' as well.
selection: "weighted_random" # Move selection is one of "weighted_random", "uniform_random" or "best_move".
# max_depth: 16 # Half move max depth. (Comment this line for max depth)
online_moves:
opening_explorer:
enabled: false # Activate online moves from Lichess opening explorer. The move that has performed best for this bot is played.
use_for_variants: false # Whether the Lichess opening explorer should be used for other variants than standard and chess960.
min_time: 20 # Time the bot must have at least to use the online move.
timeout: 5 # Time the server has to respond.
min_games: 5 # Minimum number of games in which the position must have occurred.
only_with_wins: false # Whether to play only moves that have won before.
selection: "performance" # Move selection is "performance" or "win_rate".
# max_depth: 16 # Half move max depth. (Comment this line for max depth)
chessdb:
enabled: false # Activate online moves from https://chessdb.cn/queryc_en/
min_eval_depth: 10 # Minimum evaluation depth. Only for selection: "best".
min_time: 20 # Time the bot must have at least to use the online move.
timeout: 5 # Time the server has to respond.
selection: "best" # Move selection is one of "best", "good" or "all".
# max_depth: 16 # Half move max depth. (Comment this line for max depth)
lichess_cloud:
enabled: false # Activate online moves from Lichess cloud eval.
only_without_book: false # Whether the cloud should only be used if there is no matching book.
min_eval_depth: 10 # Minimum evaluation depth.
min_time: 20 # Time the bot must have at least to use the online move.
timeout: 5 # Time the server has to respond.
# max_depth: 16 # Half move max depth. (Comment this line for max depth)
online_egtb:
enabled: false # Activate online endgame tablebases from Lichess.
min_time: 10 # Time the bot must have at least to use the online move.
timeout: 3 # Time the server has to respond.
offer_draw:
enabled: true # Activate whether the bot should offer draw.
score: 10 # If the absolute value of the score is less than or equal to this value, the bot offers/accepts draw (in cp)
consecutive_moves: 10 # How many moves in a row the absolute value of the score has to be below the draw value
min_game_length: 35 # Earliest move in which draw is offered.
resign:
enabled: false # Activate whether the bot should resign games.
score: -1000 # If the score is less than or equal to this value, the bot resigns (in cp).
consecutive_moves: 5 # How many moves in a row the score has to be below the resign value.
move_overhead_multiplier: 1.0 # Increase if your bot flags games too often. Default move overhead is 1 second per 1 minute initital time.
challenge: # Incoming challenges. (Commenting allowed)
concurrency: 1 # Number of games to play simultaneously.
bullet_with_increment_only: false # Whether bullet games against BOTs should only be accepted with increment.
# min_increment: 1 # Minimum amount of increment to accept a challenge.
# max_increment: 10 # Maximum amount of increment to accept a challenge.
# min_initial: 30 # Minimum amount of initial time to accept a challenge.
# max_initial: 1500 # Maximum amount of initial time to accept a challenge.
variants: # Chess variants to accept (https://lichess.org/variant).
- standard
# - chess960
# - fromPosition
# - antichess
# - atomic
# - crazyhouse
# - horde
# - kingOfTheHill
# - racingKings
# - threeCheck
time_controls: # Time controls to accept.
- bullet
- blitz
- rapid
- classical
bot_modes: # Game modes to accept against BOTs.
# - casual # Unrated games.
- rated # Rated games
human_modes: # Game modes to accept against humans.
- casual # Unrated games.
- rated # Rated games
matchmaking:
initial_time: 60 # Initial time for matchmaking mode.
increment: 1 # Increment time for matchmaking mode.
rated: true # Activate rated games in matchmaking mode.
timeout: 60 # Time until a challenge is canceled.
variants: # Chess variants (https://lichess.org/variant) to challenge.
- standard
# - chess960
# - antichess
# - atomic
# - crazyhouse
# - horde
# - kingOfTheHill
# - racingKings
# - threeCheck
# min_rating_diff: 0 # Minimum rating distance to opponent. (Commenting allowed)
# max_rating_diff: 300 # Maximum rating distance to opponent. (Commenting allowed)
delay: 10 # Time in seconds the bot must be idle before a new challenge is started.
books: # Names of the opening books (to be used above in the opening_books section) and paths to the opening books.
DefaultBook: "/path/to/DefaultBook.bin"
. is ther a way to make bot strongerr? sorry for isssue
I want to know how to increase my bot's strength and why it times out quite often while playing with AI level 8 ?
Hey @Torom I have a few suggestions for the !eval command in BotLi:
+) You should add the Total nodes of the engine (Not the nps I mean all nodes counted. I see other Lichess Bot repos also have this like github.com/ShailChoksi/Lichess-bot)
+) I think the depth is quite hard to understand
Like 19/48 36/4 and so on
So you should use the depth only and no /4 or /36 at the botom
Hope you read and reply to me
Thanks :D
So I want to deploy my repi with heroku but it's not connecting can u write thr command line how to upload with git in heroku branch plz
I don't know why the heck fairy-stockfish 14's nps: 0.5m but the stockfish dev nps: 2-5M and it loses many games please help
Can you help me how to get NNUE files to make stockfish dev better (standard) and antichess NNUE file for fsf pls
Do you have the same issue as mine ?
_Traceback (most recent call last):
File "C:\Users\olymp\Downloads\BotLi-main2\user_interface.py", line 5, in <module>
from api import API
File "C:\Users\olymp\Downloads\BotLi-main2\api.py", line 5, in <module>
import requests
ModuleNotFoundError: No module named 'requests'_
Idk how to fix this:
challenge RaspFish [60] [1] [White] [RATED] [standrard]
invalid literal for int() with base 10: '[10]'
How can I run stockfish and fairy-stockfish at a same time? Is it possible? Thanks
I tried to edit the Dockerfile
How do I automatically update my repo I pulled request and what next then? please help
And how to make my bot don't get timed out quite often please alr tried bullet with incre
Book: 1... Nf6
Exception in thread Thread-4:
Traceback (most recent call last):
File "C:\Users\olymp\AppData\Roaming\Python\Python310\site-packages\chess\engine.py", line 1734, in analysis
return await self.communicate(UciAnalysisCommand)
File "C:\Users\olymp\AppData\Roaming\Python\Python310\site-packages\chess\engine.py", line 1080, in communicate
return await command.result
asyncio.exceptions.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\Python310\lib\asyncio\tasks.py", line 456, in wait_for
return fut.result()
asyncio.exceptions.CancelledError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Program Files\Python310\lib\threading.py", line 1016, in _bootstrap_inner
self.run()
File "C:\Users\olymp\Downloads\BotLi-main\game.py", line 44, in run
uci_move, offer_draw, resign = self.lichess_game.make_move()
File "C:\Users\olymp\Downloads\BotLi-main\lichess_game.py", line 70, in make_move
self.engine.analysis(self.board)
File "C:\Users\olymp\AppData\Roaming\Python\Python310\site-packages\chess\engine.py", line 2803, in analysis
return SimpleAnalysisResult(self, future.result())
File "C:\Program Files\Python310\lib\concurrent\futures_base.py", line 458, in result
return self.__get_result()
File "C:\Program Files\Python310\lib\concurrent\futures_base.py", line 403, in __get_result
raise self._exception
File "C:\Program Files\Python310\lib\asyncio\tasks.py", line 458, in wait_for
raise exceptions.TimeoutError() from exc
asyncio.exceptions.TimeoutError
Ye thats the thing I recieved in the terminal when trying to play with another bot
Exception in thread Thread-4:
Traceback (most recent call last):
File "C:\Program Files\Python310\lib\threading.py", line 1016, in _bootstrap_inner
self.run()
File "C:\Users\olymp\Downloads\BotLi-main\game.py", line 63, in run
uci_move, offer_draw, resign = self.lichess_game.make_move()
File "C:\Users\olymp\Downloads\BotLi-main\lichess_game.py", line 54, in make_move
elif response := self._make_opening_explorer_move():
File "C:\Users\olymp\Downloads\BotLi-main\lichess_game.py", line 257, in _make_opening_explorer_move
enabled = self.config['engine']['online_moves']['opening_explorer']['enabled']
KeyError: 'opening_explorer'
BotLi already mention that install all requirement but how can we download this
python -m pip install -r requirements.txt
And after putting everything u have wrote how to control
So as I understand in cmd(Command promot) we have to type 1st
git clone https://github.com/Torom/BotLi.git
Then CD Botli
After then I canr understand
Plz explain what to do next after cd bot li and dont tell about enginr and book as I using already just tell after botli
Hi, can you solve the books section error?
raise Exception(f'The book "{book}" is not defined in the books section.')
Exception: The book "./Perfect2022.bin" is not defined in the books section.
Hi Torom!
I propose an option called "ChallengeDelay" so that the BOT only launches a challenge after a moment of inactivity.
I noticed that when my BOT uses BotLi, it can do ~100 games so when adding a delay of even 1 minute or more, it can do double that.
The option is available on ShailChoksi / lichess-bot, and I think it could be a plus.
What do you think about it?
Sincerely,
A BotLi user
Is there a way to increase node/NPS, hash and Depth calculated in BotLi ?
how to setup a cloud link to the relevent opening and setting to the directory
Hey, how can I adjust my bot's accepted time control? I mean I have to adjust the minutes per side to 1 minute
I have been using botli yesterday and in the logs it shows
2022-07-12T01:48:23.480452+00:00 heroku[worker.1]: Process running mem=635M(124.1%)
2022-07-12T01:48:23.486168+00:00 heroku[worker.1]: Error R14 (Memory quota exceeded)
And another issue is i have created my own book and i have uploaded to engines in my fork and when i start the dynos it takes a really long time and Bot immediately stops after using the book.My problem is without a book its ok but when i use my book engine automatically stops.How to fix this issue???
Torom can you try making the code compatible for cloudfare.com ?
i know how to use matchmaking when running the bot locally on my pc but how to use matchmaking on Heroku ?
this is the log
python3 user_interface.py Traceback (most recent call last): File "/home/xxxxx/BotLi/user_interface.py", line 5, in <module> from api import API File "/home/xxxxxx/BotLi/api.py", line 10, in <module> class API: File "/home/xxxxxx/BotLi/api.py", line 44, in API variant: Variant, timeout: int) -> str | None: TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'
This happened when I started to play a horde game:
2022-08-06T14:44:15.446393+00:00 app[worker.1]: Exception in thread Thread-4:
2022-08-06T14:44:15.446425+00:00 app[worker.1]: Traceback (most recent call last):
2022-08-06T14:44:15.446456+00:00 app[worker.1]: File "/usr/lib/python3.10/threading.py", line 1009, in _bootstrap_inner
2022-08-06T14:44:15.446727+00:00 app[worker.1]: self.run()
2022-08-06T14:44:15.446735+00:00 app[worker.1]: File "/game.py", line 42, in run
2022-08-06T14:44:15.446796+00:00 app[worker.1]: uci_move, offer_draw, resign = self.lichess_game.make_move()
2022-08-06T14:44:15.446806+00:00 app[worker.1]: File "/lichess_game.py", line 62, in make_move
2022-08-06T14:44:15.446870+00:00 app[worker.1]: move, info = self._make_engine_move()
2022-08-06T14:44:15.446872+00:00 app[worker.1]: File "/lichess_game.py", line 338, in _make_engine_move
2022-08-06T14:44:15.446968+00:00 app[worker.1]: result = self.engine.play(self.board, limit, info=chess.engine.INFO_ALL, ponder=ponder)
2022-08-06T14:44:15.446970+00:00 app[worker.1]: File "/usr/local/lib/python3.10/dist-packages/chess/engine.py", line 2781, in play
2022-08-06T14:44:15.447360+00:00 app[worker.1]: return future.result()
2022-08-06T14:44:15.447362+00:00 app[worker.1]: File "/usr/lib/python3.10/concurrent/futures/_base.py", line 446, in result
2022-08-06T14:44:15.447464+00:00 app[worker.1]: return self.__get_result()
2022-08-06T14:44:15.447466+00:00 app[worker.1]: File "/usr/lib/python3.10/concurrent/futures/_base.py", line 391, in __get_result
2022-08-06T14:44:15.447555+00:00 app[worker.1]: raise self._exception
2022-08-06T14:44:15.447557+00:00 app[worker.1]: File "/usr/lib/python3.10/asyncio/tasks.py", line 445, in wait_for
2022-08-06T14:44:15.447657+00:00 app[worker.1]: return fut.result()
2022-08-06T14:44:15.447665+00:00 app[worker.1]: File "/usr/local/lib/python3.10/dist-packages/chess/engine.py", line 1671, in play
2022-08-06T14:44:15.447902+00:00 app[worker.1]: return await self.communicate(UciPlayCommand)
2022-08-06T14:44:15.447905+00:00 app[worker.1]: File "/usr/local/lib/python3.10/dist-packages/chess/engine.py", line 1080, in communicate
2022-08-06T14:44:15.448071+00:00 app[worker.1]: return await command.result
2022-08-06T14:44:15.448084+00:00 app[worker.1]: chess.engine.EngineTerminatedError: engine process died unexpectedly (exit code: 1)
I don't what the problem is but it automatically gets time outed
how can i download the nnue to the botli heroku
Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Program Files\Python310\lib\threading.py", line 1016, in _bootstrap_inner
self.run()
File "C:\Users\olymp\Downloads\BotLi-main2\game_manager.py", line 51, in run
self._start_game(self.started_game_ids.popleft())
File "C:\Users\olymp\Downloads\BotLi-main2\game_manager.py", line 107, in _start_game
self.games[game_id] = Game(self.config, self.api, game_id)
File "C:\Users\olymp\Downloads\BotLi-main2\game.py", line 19, in __init__
self.chatter = Chatter(api, config, game_id)
TypeError: Chatter.__init__() takes 2 positional arguments but 4 were given
I got this error when a game is starting, please help
Idk what is this when the bot is in book move
Book: 16... Re8 100 % or sometime it is 25% 50% i have no idea :C Please help what is that percentage for
And what is this "TB" ? Hash: 2.2 % TB: 34.1 k
Also why the hash is not 100 % pls help idk
help me torom
File "C:\Program Files\Python310\lib\threading.py", line 1016, in _bootstrap_inner
self.run()
File "C:\Users\Downloads\BotLi-main\game.py", line 60, in run
uci_move, offer_draw, resign = self.lichess_game.make_move()
File "C:\Users\olymp\Downloads\BotLi-main\lichess_game.py", line 70, in make_move
self.engine.analysis(self.board)
File "C:\Users\AppData\Roaming\Python\Python310\site-packages\chess\engine.py", line 2803, in analysis
return SimpleAnalysisResult(self, future.result())
File "C:\Program Files\Python310\lib\concurrent\futures_base.py", line 458, in result
return self.__get_result()
File "C:\Program Files\Python310\lib\concurrent\futures_base.py", line 403, in __get_result
raise self._exception
AFile "C:\Program Files\Python310\lib\asyncio\tasks.py", line 445, in wait_for
return fut.result()
File "C:\Users\olymp\AppData\Roaming\Python\Python310\site-packages\chess\engine.py", line 1734, in analysis
return await self.communicate(UciAnalysisCommand)
File "C:\Users\AppData\Roaming\Python\Python310\site-packages\chess\engine.py", line 1080, in communicate
return await command.result
chess.engine.EngineTerminatedError: engine process died unexpectedly (exit code: 1)
And...
File "C:\Program Files\Python310\lib\threading.py", line 1016, in _bootstrap_inner
self.run()
File "C:\Users\olymp\Downloads\BotLi-main\game.py", line 44, in run
uci_move, offer_draw, resign = self.lichess_game.make_move()
File "C:\Users\olymp\Downloads\BotLi-main\lichess_game.py", line 70, in make_move
self.engine.analysis(self.board)
File "C:\Users\olymp\AppData\Roaming\Python\Python310\site-packages\chess\engine.py", line 2803, in analysis
return SimpleAnalysisResult(self, future.result())
File "C:\Program Files\Python310\lib\concurrent\futures_base.py", line 458, in result
return self.__get_result()
File "C:\Program Files\Python310\lib\concurrent\futures_base.py", line 403, in __get_result
raise self._exception
File "C:\Program Files\Python310\lib\asyncio\tasks.py", line 458, in wait_for
raise exceptions.TimeoutError() from exc
asyncio.exceptions.TimeoutError
Exception in callback Protocol._line_received('readyok')
handle: <Handle Protocol._line_received('readyok')>
Traceback (most recent call last):
File "C:\Program Files\Python310\lib\asyncio\events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "C:\Users\olymp\AppData\Roaming\Python\Python310\site-packages\chess\engine.py", line 1040, in _line_received
self.command._line_received(self, line)
File "C:\Users\olymp\AppData\Roaming\Python\Python310\site-packages\chess\engine.py", line 1291, in _line_received
self.line_received(engine, line)
File "C:\Users\olymp\AppData\Roaming\Python\Python310\site-packages\chess\engine.py", line 1702, in line_received
self._readyok(engine)
File "C:\Users\olymp\AppData\Roaming\Python\Python310\site-packages\chess\engine.py", line 1715, in _readyok
self.result.set_result(self.analysis)
asyncio.exceptions.InvalidStateError: invalid state
No idea for that error :C
Hey @Torom,
In config.yml. default I don't understand this matchmaking config:
min_rating_diff: 0 # Minimum rating distance to opponent. (Commenting allowed)
max_rating_diff: 500 # Maximum rating distance to opponent. (Commenting allowed)
At the moment my bot is 2655 rated so why starting matchmaking it said no bots in range ?
Can you tell me a bit more on this min max rating config
Thank you
I really want to know how to set up lc0 to BotLi.Is there a way that i can setup ??? i want to know whether there is a possibility and the lc0's supported commands to botli as well
Please look at my config.yml and see why I got this...
2022-08-13T02:53:15.595614+00:00 app[worker.1]: Exception in thread Thread-4:
2022-08-13T02:53:15.595627+00:00 app[worker.1]: Traceback (most recent call last):
2022-08-13T02:53:15.595628+00:00 app[worker.1]: File "/usr/lib/python3.10/threading.py", line 1009, in _bootstrap_inner
2022-08-13T02:53:15.595977+00:00 app[worker.1]: self.run()
2022-08-13T02:53:15.595988+00:00 app[worker.1]: File "/game.py", line 58, in run
2022-08-13T02:53:15.596092+00:00 app[worker.1]: uci_move, offer_draw, resign = self.lichess_game.make_move()
2022-08-13T02:53:15.596092+00:00 app[worker.1]: File "/lichess_game.py", line 72, in make_move
2022-08-13T02:53:15.596170+00:00 app[worker.1]: self.engine.analysis(self.board)
2022-08-13T02:53:15.596171+00:00 app[worker.1]: File "/usr/local/lib/python3.10/dist-packages/chess/engine.py", line 2798, in analysis
2022-08-13T02:53:15.596826+00:00 app[worker.1]: with self._not_shut_down():
2022-08-13T02:53:15.596849+00:00 app[worker.1]: File "/usr/lib/python3.10/contextlib.py", line 135, in enter
2022-08-13T02:53:15.596963+00:00 app[worker.1]: return next(self.gen)
2022-08-13T02:53:15.596978+00:00 app[worker.1]: File "/usr/local/lib/python3.10/dist-packages/chess/engine.py", line 2740, in _not_shut_down
2022-08-13T02:53:15.597591+00:00 app[worker.1]: raise EngineTerminatedError("engine event loop dead")
2022-08-13T02:53:15.597618+00:00 app[worker.1]: chess.engine.EngineTerminatedError: engine event loop dead
Hey @Torom I am having an error with fsf it looks like this...
2022-09-06T06:17:56.311180+00:00 app[worker.1]: Traceback (most recent call last):
2022-09-06T06:17:56.311202+00:00 app[worker.1]: File "//user_interface.py", line 213, in
2022-09-06T06:17:56.311306+00:00 app[worker.1]: ui = UserInterface()
2022-09-06T06:17:56.311313+00:00 app[worker.1]: File "//user_interface.py", line 24, in init
2022-09-06T06:17:56.311372+00:00 app[worker.1]: self.config = load_config()
2022-09-06T06:17:56.311375+00:00 app[worker.1]: File "/config.py", line 40, in load_config
2022-09-06T06:17:56.311434+00:00 app[worker.1]: raise Exception(f'Your config.yml does not have required engine
subsection {subsection[0]}
.')
2022-09-06T06:17:56.311444+00:00 app[worker.1]: Exception: Your config.yml does not have required engine
subsection syzygy
.
Hello. I am trying to load stockfish 14 to the Dockerfile on Heroku, I am not sure how to do it. Can you help, thanks
I think u should try to make it sends the results continuously
Just 1 !eval then it should sends all the moves ???
Got this error:
400 Client Error: Bad Request for url: https://lichess.org/api/bot/account/upgrade
Upgrade failed.
Hey I did replace the original verson of Chatter.py you can take a look:
import os
import platform
import psutil
from api import API
from lichess_game import Lichess_Game
class Chat_Message:
def __init__(self, chatLine_event: dict) -> None:
self.username: str = chatLine_event['username']
self.text: str = chatLine_event['text']
self.room: str = chatLine_event['room']
class Chatter:
def __init__(self, api: API, config: dict, game_id: str) -> None:
self.api = api
self.game_id = game_id
self.username = self.api.user['username']
self.cpu_message = self._get_cpu()
self.draw_message = self._get_draw_message(config)
self.ram_message = self._get_ram()
self.print_eval_rooms: set[str] = set()
def handle_chat_message(self, chatLine_Event: dict, lichess_game: Lichess_Game) -> None:
chat_message = Chat_Message(chatLine_Event)
if chat_message.username == 'lichess':
if chat_message.room == 'player':
print(f'{chat_message.username}: {chat_message.text}')
return
elif chat_message.username == self.username:
return
print(f'{chat_message.username} ({chat_message.room}): {chat_message.text}')
if chat_message.text.startswith('!'):
if response := self._handle_command(chat_message, lichess_game):
self.api.send_chat_message(self.game_id, chat_message.room, response)
def print_eval(self, lichess_game: Lichess_Game) -> None:
for room in self.print_eval_rooms:
self.api.send_chat_message(self.game_id, room, lichess_game.last_message)
def _handle_command(self, chat_message: Chat_Message, lichess_game: Lichess_Game) -> str | None:
command = chat_message.text[1:].lower()
if command == 'cpu':
return self.cpu_message
elif command == 'draw':
return self.draw_message
elif command == 'engine':
return lichess_game.engine.id['name']
elif command == 'eval':
return lichess_game.last_message
elif command == 'name':
return f'{self.username} running {lichess_game.engine.id["name"]} (BotLi)'
elif command == 'printeval':
if not lichess_game.increment and lichess_game.initial_time < 180_000:
return 'Time control is too fast for this function.'
self.print_eval_rooms.add(chat_message.room)
return lichess_game.last_message
elif command == 'stopeval':
self.print_eval_rooms.discard(chat_message.room)
elif command == 'ram':
return self.ram_message
else:
return 'Supported commands: !cpu, !draw, !engine, !eval, !name, !printeval / !stopeval, !ram'
def _get_cpu(self) -> str:
cpu = ''
if os.path.exists('/proc/cpuinfo'):
with open('/proc/cpuinfo', 'r', encoding='utf-8') as cpuinfo:
while line := cpuinfo.readline():
if line.startswith('model name'):
cpu = line.split(': ')[1]
cpu = cpu.replace('(R)', '')
cpu = cpu.replace('(TM)', '')
if len(cpu.split()) > 1:
return cpu
if processor := platform.processor():
cpu = processor.split()[0]
cpu = cpu.replace('GenuineIntel', 'Intel')
cores = psutil.cpu_count(logical=False)
threads = psutil.cpu_count(logical=True)
try:
cpu_freq = psutil.cpu_freq().max / 1000
except FileNotFoundError:
cpu_freq = float('NaN')
return f'{cpu} {cores}c/{threads}t @ {cpu_freq:.2f}GHz'
def _get_ram(self) -> str:
mem_bytes = psutil.virtual_memory().total
mem_gib = mem_bytes/(1024.**3)
return f'{mem_gib:.1f} GiB'
def _get_draw_message(self, config: dict) -> str:
draw_enabled = config['engine']['offer_draw']['enabled']
if not draw_enabled:
return 'This bot will neither accept nor offer draws.'
min_game_length = config['engine']['offer_draw']['min_game_length']
max_score = config['engine']['offer_draw']['score'] / 100
consecutive_moves = config['engine']['offer_draw']['consecutive_moves']
return f'The bot offers draw at move {min_game_length} or later ' \
f'if the eval is within +{max_score:.2f} to -{max_score:.2f} for the last {consecutive_moves} moves.'
After that, the bot played normally but it cant chat any more idk why
I am stucked for a few days rn:
Exception in thread Thread-4:
Traceback (most recent call last):
File "C:\Program Files\Python310\lib\threading.py", line 1016, in _bootstrap_inner
self.run()
File "C:\Users\olymp\Downloads\BotLi-main\game.py", line 35, in run
if event['type'] == 'gameFull':
KeyError: 'type'
how can i set up fsf on heroku
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.