Giter VIP home page Giter VIP logo

lichess-bot's People

Contributors

actions-user avatar attackingordefending avatar ddugovic avatar dependabot[bot] avatar forhavu avatar gbtami avatar greg-finley avatar hyperchessbot avatar icecream17 avatar jlherren avatar klaus-p avatar ksdc2020 avatar lakinwecker avatar lucasart avatar lun-moon avatar markzh avatar mendelsshop avatar mheinzel avatar nkoppel avatar noobpwnftw avatar oivas000 avatar ornicar avatar queensgambit avatar ravenslofty avatar shailchoksi avatar srimethan avatar theyobots avatar tttony avatar version-bot avatar wakamex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lichess-bot's Issues

Auto abort game if white doesn't make first move

I've noticed an issue locking up the bot where users do not make the first move and the bot will wait indefinatly for the move.
There should be an option auto_abort_time: <seconds> (default: 30) where if white doesnt make the first move in x seconds the bot will abort the game, allowing for other games to be played.

This was brought to my attention on reddit: https://www.reddit.com/r/chess/comments/8e3m52/you_can_now_play_leela_chess_zero_on_lichesscom/dxsrdrf/?context=3

Support for Variants

Set UCI option "UCI_Variant" to key obtained from "variant" field of "Game info" when setting up the engine. So the engine can automatically switch to the correct variant when a game starts.

auto-abort

using the existing li.abort(game.id), when the opponent fails to play their first move in 20 seconds.

Why not use conda package manager ( Miniconda )?

This is really not an issue for me, because I can install the thing for myself, but I watch the readme getting more and more complicated about creating an environment and I see all the user complaints.

Would it not be easier to just require the user to install conda package manager ( Miniconda )?

https://conda.io/miniconda.html

Creating an environment is sort of trivial in conda. Conda has an own console and you can create and activate the env there, but in my experience the environment you create with conda then can be used by simply cd-ing in it in a simple console as well.

Playing speed

For some reason the bot is playing very slowly, and always loses on time (by a big margin) taking way too much time even for obvious moves. What could be the cause? Does it have something to do with the option "Threads" and "hash"? Also, it's not clear to me what should I put on those fields.

ERROR:backoff:Backing off api_post(...)

Hello,

Thanks for a great initiative on bridge between lichess and engines. This is really great!

I am running the bot on Windows using python3 and normally it works well. Sometimes, however, when bot accepts games the lichess-bot fails with the following error:

Accept UltraBullet challenge from Stockfish9-FullPower
ERROR:backoff:Backing off api_post(...) for 0.8s (requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://lichess.org/challenge/4rwLnEPj/accept) ERROR:backoff:Backing off api_post(...) for 1.0s (requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://lichess.org/challenge/4rwLnEPj/accept) ERROR:backoff:Backing off api_post(...) for 2.2s (requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://lichess.org/challenge/4rwLnEPj/accept) ERROR:backoff:Backing off api_post(...) for 1.8s (requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://lichess.org/challenge/4rwLnEPj/accept) ERROR:backoff:Backing off api_post(...) for 13.7s (requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://lichess.org/challenge/4rwLnEPj/accept) ERROR:backoff:Giving up api_post(...) after 6 tries (requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://lichess.org/challenge/4rwLnEPj/accept)

Then it fails. The problems seems to be sporadic, it does not happen every time. I wonder if there are any fixes for this that address the problem?

Thanks in advance,
with best regards, Volodymyr.

Create seek

It would be a great enhancement having a new seek section in config.yml with some user defined seek lines. Using this if a BOT has a free process (and challenges queue is empty) pychess-bot automatically send a new seek (picking the next one from config.yml seek section) to be appear on lichess lobby tab.

NameError: name 'true' is not defined for accept_bot_challenges

File "main.py", line 252, in <module>
    start(li, user_profile, engine_factory, CONFIG)
  File "main.py", line 63, in start
    if chlng.is_supported(config):
  File "/home/francis/lichess-bot/model.py", line 33, in is_supported
    if not config.get("accept_bot_challenges", true) and self.challenger_is_bot:

My line is different because of local changes, but this is the culprit.

https://github.com/careless25/lichess-bot/blob/b8ad9213125102a1d37e3c99dc4b435d09cf7fd6/model.py#L30

Bad Request for url

PyChessBot losed this game on time because it's latest move can't get through in this position:
https://lichess.org/cv25KskE#58

The relevant log was:

DEBUG:chess.engine:<PopenProcess at 0x7f368a5782e8 (pid=2500)> >> move Rxh7
DEBUG:requests.packages.urllib3.connectionpool:https://lichess.org:443 "POST /bot/game/cv25KskE/move/b7h7 HTTP/1.1" 200 None
DEBUG:chess.engine:<PopenProcess at 0x7f368a5782e8 (pid=2500)> << force
DEBUG:chess.engine:<PopenProcess at 0x7f368a5782e8 (pid=2500)> << setboard 6r1/p6R/2p5/8/4Pk2/5P1B/PP1N1P1P/2K5 w - - 1 30
DEBUG:chess.engine:<PopenProcess at 0x7f368a5782e8 (pid=2500)> << time 81.0
DEBUG:chess.engine:<PopenProcess at 0x7f368a5782e8 (pid=2500)> << otim 339.0
DEBUG:chess.engine:<PopenProcess at 0x7f368a5782e8 (pid=2500)> << go
DEBUG:chess.engine:<PopenProcess at 0x7f368a5782e8 (pid=2500)> >> # Time left: 0.81 s; Planing to think for 2.00 s
DEBUG:chess.engine:<PopenProcess at 0x7f368a5782e8 (pid=2500)> >> 1 2853 0 39 Rxa7
DEBUG:chess.engine:<PopenProcess at 0x7f368a5782e8 (pid=2500)> >> 2 2846 4 302 Rf7+ Ke5 Rxa7
DEBUG:chess.engine:<PopenProcess at 0x7f368a5782e8 (pid=2500)> >> 3 2902 14 1240 Rf7+ Kg5 Rxa7
DEBUG:chess.engine:<PopenProcess at 0x7f368a5782e8 (pid=2500)> >> 4 2853 57 4636 Rf7+ Kg5 Rxa7 Kf4
DEBUG:chess.engine:<PopenProcess at 0x7f368a5782e8 (pid=2500)> >> move Rf7+
DEBUG:requests.packages.urllib3.connectionpool:https://lichess.org:443 "POST /bot/game/cv25KskE/move/h7f7 HTTP/1.1" 400 None
ERROR:backoff:Giving up api_post(...) after 1 tries (requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://lichess.org/bot/game/cv25KskE/move/h7f7)
Abandoning game due to connection error
Traceback (most recent call last):
  File "main.py", line 128, in play_game
    li.make_move(game.id, best_move)
  File "/home/tamas/lichess-bot/lichess.py", line 68, in make_move
    return self.api_post(ENDPOINTS["move"].format(game_id, move))
  File "/usr/local/lib/python3.5/dist-packages/backoff/_sync.py", line 99, in retry
    ret = target(*args, **kwargs)
  File "/home/tamas/lichess-bot/lichess.py", line 58, in api_post
    response.raise_for_status()
  File "/home/tamas/.local/lib/python3.5/site-packages/requests/models.py", line 893, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://lichess.org/bot/game/cv25KskE/move/h7f7
--- https://lichess.org//cv25KskE/white Game over
DEBUG:chess.engine:<PopenProcess at 0x7f368a5782e8 (pid=2500)> << quit
+++ Process Free. Total Queued: 0. Total Used: 0

Is this a lichess-bot bug or something else?

Auto aborting BOT games

Many spectators looking at https://lichess.org/@/LeelaChess/tv LeelaChess vs TiagoRibeiro3 1+0 rated bullet game right now. BOT played 1. e4 but the human opponent seems to not responding at all and he was disconnected.

BOT games should be aborted if opponent is not responding in given time after BOT first move was taken. Similar to human-human games.

Crashing when accepting game

Dump:

.   _/|
.  // o\
.  || ._)  lichess-bot 0.2
.  //__\
.  )___(   Play on Lichess with a bot

Welcome LeelaZero-UK!
    Queue Bullet challenge from leonrades
    Accept Bullet challenge from leonrades
--- Process Queue. Total Queued: 1. Total Used: 0
--- Process Used. Total Queued: 0. Total Used: 1
Traceback (most recent call last):
  File "G:\lichess-bot\logging_pool.py", line 16, in __call__
    result = self.__callable(*args, **kwargs)
  File "G:\lichess-bot\main.py", line 96, in play_game
    engine = engine_factory(board)
  File "G:\lichess-bot\engine_wrapper.py", line 27, in create_engine
    return UCIEngine(board, commands, ucioptions)
  File "G:\lichess-bot\engine_wrapper.py", line 104, in __init__
    self.engine = chess.uci.popen_engine(commands)
  File "G:\lichess-bot\.venv\lib\site-packages\chess\uci.py", line 1138, in popen_engine
    return _popen_engine(command, engine_cls, setpgrp, _popen_lock, **kwargs)
  File "G:\lichess-bot\.venv\lib\site-packages\chess\engine.py", line 315, in _popen_engine
    PopenProcess(engine, command, **popen_args)
  File "G:\lichess-bot\.venv\lib\site-packages\chess\engine.py", line 145, in __init__
    self.process = subprocess.Popen(command, **popen_args)
  File "C:\Python3\Lib\subprocess.py", line 709, in __init__
    restore_signals, start_new_session)
  File "C:\Python3\Lib\subprocess.py", line 971, in _execute_child
    args = list2cmdline(args)
  File "C:\Python3\Lib\subprocess.py", line 461, in list2cmdline
    needquote = (" " in arg) or ("\t" in arg) or not arg
TypeError: argument of type 'int' is not iterable

Lags

The current master version seems to introduce a lot of lag.
My engine return best move in less than 300ms but clock on lichess side is running for 2 secondes.

It seems there is nothing wrong in my internet connection becaus eif I play game by myself, their is no lag, so probably something inside lichess-bot ?

Do not play aborted games

EDIT: Sorry, I didn't check if a6bbfd7 is to blame. I'll check that later today...

If a game is aborted before the opponent moves, don't spawn dozens of engines (but move on to the next game).

Currently the following is logged (Python3):

Game over!
Accepting challenge #mzU91wmX from lovlas!
Loading Engine!
Game Info: {'perf': {'name': 'Bullet'}, 'id': 'u1qO627s', 'white': {'name': 'Purusa', 'id': 'purusa', 'rating': 2242, 'title': None}, 'createdAt': 1524055220544, 'state': {'moves': 'e2e4', 'winc': 0, 'wtime': 60000, 'btime': 60000, 'binc': 0}, 'speed': 'bullet', 'variant': {'name': 'Standard', 'short': 'Std', 'key': 'standard'}, 'black': {'provisional': True, 'name': 'GodelEscherBot', 'id': 'godelescherbot', 'rating': 2551, 'title': None}, 'initialFen': 'startpos', 'rated': False}
Now playing https://lichess.org/u1qO627s
Something went wrong! status_code: 400, response: {"error":"Not your turn, or game already over"}

Something went wrong. Game is starting and we don't have a queued process

(.venv) folkert@freytus ~/lichess-bot $ python3 main.py 
Welcome embla!
Something went wrong. Game is starting and we don't have a queued process
--- Process Used. Total Queued: 0. Total Used: 1
Traceback (most recent call last):
  File "/home/folkert/lichess-bot/logging_pool.py", line 16, in __call__
    result = self.__callable(*args, **kwargs)
  File "main.py", line 89, in play_game
    game = model.Game(json.loads(next(updates).decode('utf-8')), username, li.baseUrl)
  File "/home/folkert/lichess-bot/model.py", line 33, in __init__
    self.clock_initial = json.get("clock")["initial"]
TypeError: 'NoneType' object is not subscriptable
token: "..."    
url: "https://lichess.org/"  

engine:                      
  dir: "./engines/"          
  name: "Embla"        
  protocol: "uci"            


max_concurrent_games: 1      
max_queued_challenges: 8     

supported_variants:          
  - standard

supported_tc:                
  - ultraBullet
  - bullet
  - blitz
  - rapid
  - classical
  - correspondence

supported_modes:             
  - casual                   
  - rated                    

print_engine_stats: true    

can't handle "ebf" in uci progress reports

ValueError: invalid literal for int() with base 10: '1.00'
ERROR:chess.engine:exception parsing score cp value
Traceback (most recent call last):
  File "/home/folkert/lichess-bot/.venv/lib/python3.4/site-packages/chess/uci.py", line 534, in _info
    score_cp = int(token)
ValueError: invalid literal for int() with base 10: 'ebf'
ERROR:chess.engine:exception parsing score cp value
Traceback (most recent call last):
  File "/home/folkert/lichess-bot/.venv/lib/python3.4/site-packages/chess/uci.py", line 534, in _info
    score_cp = int(token)
info depth 1 seldepth 1 score cp 106 time 2 nodes 21 pv e2e4
info depth 2 seldepth 4 score cp 21 time 3 nodes 74 pv e2e4
info depth 2 seldepth 4 score cp 0 ebf 1.75 time 4 nodes 138 pv e2e4 e7e5

KeyError: 'max_concurrent_games'

EDIT: sorry I didn't see this (#20) closed issues, I will try it

Python: 3.6
Windows 7 x64

Everything installed without any error

I just type: main.py and this error is showed

Welcome SkiullOfficial!
Process Process-2:
Traceback (most recent call last):
File "C:\Python\Python36\lib\multiprocessing\process.py", line 258, in _bootstrap
self.run()
File "C:\Python\Python36\lib\multiprocessing\process.py", line 93, in run
self._target(*self._args, **self._kwargs)
File "F:\Descargas\Compressed\lichess-bot-master\skiull-0.3\main.py", line 26,
in watch_control_stream
with logging_pool.LoggingPool(CONFIG['max_concurrent_games']+1) as pool:
KeyError: 'max_concurrent_games'

Multiple Errors

Have followed the step by step exactly, only replaced the token and engine in the config.yml and this is the error I get while running python main.py (I'm trying to run leelachess)
"could not find expected ':'", self.get_mark()) yaml.scanner.ScannerError: while scanning a simple key in "./config.yml", line 4, column 1 could not find expected ':' in "./config.yml", line 5, column 3
Or when I run python3 main.py I get this:
Traceback (most recent call last): File "main.py", line 2, in <module> import chess ImportError: No module named 'chess'
Have tried starting from the default yml multiple times, error persists. Would be fine with getting a fix to either the python2.7 version or python3 version.

Book file option

Is the book file option working? I'm currently trying with an opening book and it doesn't seem to be working. Has anyone else tried?

error in "with logging_pool..."

I'm getting

Welcome ana-ka-bot!
Traceback (most recent call last):
File "main.py", line 220, in
start(li, user_profile, engine_path, weights_path, cfg.get("threads"))
File "main.py", line 37, in start
with logging_pool.LoggingPool(CONFIG['max_concurrent_games']+1) as pool:
AttributeError: exit

Can't figure out what the issue might be. :(

Opening Books for Different Varients

Currently, if you use an opening book, it will play the moves for all variants. However, this is undesirable as different variants have different moves played in the opening for example atomic most commonly games begin with 1. Nf3 f6 but in standard if 1. Nf3 is played the most common continuation is 1. ... Nf6 . Thanks, TheM492017.

Feature: Add option to resign

Perhaps if uci bot wants to resign, it will send to api,

bestmove 0000

Followeb by

info string resign

api can terminate the game and award 1 point to the opponent.

I can revise my uci engine to support this.

For xboard engine, it has command to resign.

Or perhaps if api can access the score of the bot and the bot is sending the score properly to api, api can terminate the game based on settable score and number of times that the bot has been in a bad score.

ChunkedEncodingError

DEBUG:requests.packages.urllib3.connectionpool:https://lichess.org:443 "POST /bot/game/hN3vmX6k/move/a5a4 HTTP/1.1" 200 None
--- https://lichess.org/hN3vmX6k/black Game over
DEBUG:chess.engine:<PopenProcess at 0x7fb9f81e1f28 (pid=23451)> << quit
+++ Process Free. Total Queued: 0. Total Used: 3
Process Process-2:
Traceback (most recent call last):
  File "/home/tamas/.local/lib/python3.5/site-packages/requests/packages/urllib3/response.py", line 535, in _update_chunk_length
    self.chunk_left = int(line, 16)
ValueError: invalid literal for int() with base 16: b''

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/tamas/.local/lib/python3.5/site-packages/requests/packages/urllib3/response.py", line 298, in _error_catcher
    yield
  File "/home/tamas/.local/lib/python3.5/site-packages/requests/packages/urllib3/response.py", line 590, in read_chunked
    self._update_chunk_length()
  File "/home/tamas/.local/lib/python3.5/site-packages/requests/packages/urllib3/response.py", line 539, in _update_chunk_length
    raise httplib.IncompleteRead(line)
http.client.IncompleteRead: IncompleteRead(0 bytes read)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/tamas/.local/lib/python3.5/site-packages/requests/models.py", line 703, in generate
    for chunk in self.raw.stream(chunk_size, decode_content=True):
  File "/home/tamas/.local/lib/python3.5/site-packages/requests/packages/urllib3/response.py", line 428, in stream
    for line in self.read_chunked(amt, decode_content=decode_content):
  File "/home/tamas/.local/lib/python3.5/site-packages/requests/packages/urllib3/response.py", line 618, in read_chunked
    self._original_response.close()
  File "/usr/lib/python3.5/contextlib.py", line 77, in __exit__
    self.gen.throw(type, value, traceback)
  File "/home/tamas/.local/lib/python3.5/site-packages/requests/packages/urllib3/response.py", line 316, in _error_catcher
    raise ProtocolError('Connection broken: %r' % e, e)
requests.packages.urllib3.exceptions.ProtocolError: ('Connection broken: IncompleteRead(0 bytes read)', IncompleteRead(0 bytes read))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.5/multiprocessing/process.py", line 249, in _bootstrap
    self.run()
  File "/usr/lib/python3.5/multiprocessing/process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "main.py", line 35, in watch_control_stream
    for evnt in li.get_event_stream().iter_lines():
  File "/home/tamas/.local/lib/python3.5/site-packages/requests/models.py", line 747, in iter_lines
    for chunk in self.iter_content(chunk_size=chunk_size, decode_unicode=decode_unicode):
  File "/home/tamas/.local/lib/python3.5/site-packages/requests/models.py", line 706, in generate
    raise ChunkedEncodingError(e)
requests.exceptions.ChunkedEncodingError: ('Connection broken: IncompleteRead(0 bytes read)', IncompleteRead(0 bytes read))

Why sending go movetime 2000

I have this log from my program. Game is played on TC 3+0. I am using lichess-bot 0.3.
Notice the,
go movetime 2000
is this intentional?

Later it sent the correct one.
go wtime 180000 btime 178850 winc 0 binc 0

2018-04-22_18.12.15 << Open log-2018-04-22_18.12.15.txt for logging
2018-04-22_18.12.15 >> uci
2018-04-22_18.12.15 >> setoption name Hash value 128
2018-04-22_18.12.15 >> setoption name NetworkLag value 10
2018-04-22_18.12.15 >> setoption name MaterialWeight value 90
2018-04-22_18.12.15 >> setoption name PassedPawnWeight value 180
2018-04-22_18.12.15 >> setoption name MobilityWeight value 250
2018-04-22_18.12.15 >> setoption name ThreatWeight value 300
2018-04-22_18.12.15 >> setoption name KingAttackWeight value 30
2018-04-22_18.12.15 >> setoption name KingShelterWeight value 150
2018-04-22_18.12.15 >> setoption name RepeatScore value -50
2018-04-22_18.12.15 >> isready
2018-04-22_18.12.15 << readyok
2018-04-22_18.12.15 >> setoption name UCI_Variant value chess
2018-04-22_18.12.15 >> isready
2018-04-22_18.12.15 << readyok
2018-04-22_18.12.15 >> position startpos
2018-04-22_18.12.15 >> setoption name UCI_Variant value chess
2018-04-22_18.12.15 >> isready
2018-04-22_18.12.15 << readyok
2018-04-22_18.12.15 >> position startpos
2018-04-22_18.12.15 >> go movetime 2000
2018-04-22_18.12.15 << book move d2d4
2018-04-22_18.12.15 << bestmove d2d4
2018-04-22_18.12.21 >> setoption name UCI_Variant value chess
2018-04-22_18.12.21 >> isready
2018-04-22_18.12.21 << readyok
2018-04-22_18.12.21 >> position fen rnbqkbnr/pppppppp/8/8/3P4/8/PPP1PPPP/RNBQKBNR b KQkq - 0 1 moves d7d5
2018-04-22_18.12.21 >> go wtime 180000 btime 180000 winc 0 binc 0
2018-04-22_18.12.21 << book move c2c4
2018-04-22_18.12.21 << bestmove c2c4
2018-04-22_18.12.24 >> setoption name UCI_Variant value chess
2018-04-22_18.12.24 >> isready
2018-04-22_18.12.24 << readyok
2018-04-22_18.12.24 >> position fen rnbqkbnr/ppp1pppp/8/3p4/2PP4/8/PP2PPPP/RNBQKBNR b KQkq - 0 2 moves e7e6
2018-04-22_18.12.24 >> go wtime 180000 btime 178850 winc 0 binc 0

No time control command sent to xboard engine

The latest revert-fix-first-search patch fixed time control handling when xboard engine doesn't use polyglot book but unfortunately introduced new bug (no time control sent at all) when they do use it:

DEBUG:requests.packages.urllib3.connectionpool:https://lichess.org:443 "GET /api/bot/game/stream/d3p0IL08 HTTP/1.1" 200 None
DEBUG:chess.engine:<PopenProcess at 0x7fc564f74b00 (pid=31042)> << xboard
DEBUG:chess.engine:<PopenProcess at 0x7fc564f74b00 (pid=31042)> << protover 2
DEBUG:chess.engine:<PopenProcess at 0x7fc564f74b00 (pid=31042)> << post
DEBUG:chess.engine:<PopenProcess at 0x7fc564f74b00 (pid=31042)> << easy
DEBUG:chess.engine:<PopenProcess at 0x7fc564f74b00 (pid=31042)> << ping 123
DEBUG:chess.engine:<PopenProcess at 0x7fc564f74b00 (pid=31042)> >> # PyChess 0.99.1 [pypy3 3.5.3]
DEBUG:chess.engine:<PopenProcess at 0x7fc564f74b00 (pid=31042)> >> feature ping=1 setboard=1 playother=1 san=1 usermove=1 time=1 draw=1 sigint=0 sigterm=0 reuse=1 analyze=1 myname="PyChess 0.99.1" variants="normal,wildcastle,nocastle,fischerandom,crazyhouse,losers,suicide,giveaway,horde,atomic,racingkings,kingofthehill,3check,asean,cambodian,makruk,sittuyin" colors=0 ics=0 name=0 pause=0 nps=0 debug=1 memory=0 smp=0 egt="gaviota" option="skipPruneChance -slider 0 0 100"
DEBUG:chess.engine:<PopenProcess at 0x7fc564f74b00 (pid=31042)> >> feature done=1
DEBUG:chess.engine:<PopenProcess at 0x7fc564f74b00 (pid=31042)> >> pong 123
DEBUG:chess.engine:<PopenProcess at 0x7fc564f74b00 (pid=31042)> << egtpath gaviota ../Gaviota/Gaviota
DEBUG:chess.engine:<PopenProcess at 0x7fc564f74b00 (pid=31042)> << force
DEBUG:chess.engine:<PopenProcess at 0x7fc564f74b00 (pid=31042)> << setboard rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
+++ https://lichess.org/d3p0IL08/white Blitz vs Beige(1751)
DEBUG:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): lichess.org
DEBUG:requests.packages.urllib3.connectionpool:https://lichess.org:443 "POST /api/bot/game/d3p0IL08/move/g1f3 HTTP/1.1" 200 None
DEBUG:requests.packages.urllib3.connectionpool:https://lichess.org:443 "POST /api/bot/game/d3p0IL08/move/c2c4 HTTP/1.1" 200 None
DEBUG:requests.packages.urllib3.connectionpool:https://lichess.org:443 "POST /api/bot/game/d3p0IL08/move/e2e3 HTTP/1.1" 200 None
DEBUG:requests.packages.urllib3.connectionpool:https://lichess.org:443 "POST /api/bot/game/d3p0IL08/move/e3d4 HTTP/1.1" 200 None
DEBUG:requests.packages.urllib3.connectionpool:https://lichess.org:443 "POST /api/bot/game/d3p0IL08/move/g2g3 HTTP/1.1" 200 None
DEBUG:chess.engine:<PopenProcess at 0x7fc564f74b00 (pid=31042)> << force
DEBUG:chess.engine:<PopenProcess at 0x7fc564f74b00 (pid=31042)> << setboard rn1qkbnr/pp2pppp/8/5b2/2Pp4/5NP1/PP1P1P1P/RNBQKB1R w KQkq - 1 6
DEBUG:chess.engine:<PopenProcess at 0x7fc564f74b00 (pid=31042)> << time 31198.0
DEBUG:chess.engine:<PopenProcess at 0x7fc564f74b00 (pid=31042)> << otim 29156.0
DEBUG:chess.engine:<PopenProcess at 0x7fc564f74b00 (pid=31042)> << go
DEBUG:chess.engine:<PopenProcess at 0x7fc564f74b00 (pid=31042)> >> # remaining moves estimate=69.55331928214001
DEBUG:chess.engine:<PopenProcess at 0x7fc564f74b00 (pid=31042)> >> # Searching to depth 10 without timelimit
DEBUG:chess.engine:<PopenProcess at 0x7fc564f74b00 (pid=31042)> >> 1 -24 3 50 c5
DEBUG:chess.engine:<PopenProcess at 0x7fc564f74b00 (pid=31042)> >> 2 -47 28 449 Nh4 Be4
DEBUG:chess.engine:<PopenProcess at 0x7fc564f74b00 (pid=31042)> >> 3 -18 146 2407 Bg2 d3 O-O
DEBUG:chess.engine:<PopenProcess at 0x7fc564f74b00 (pid=31042)> >> 4 -69 642 13281 Bg2 Bxb1 Qa4+ Nc6 Rxb1
DEBUG:chess.engine:<PopenProcess at 0x7fc564f74b00 (pid=31042)> >> 5 -18 1525 50161 Bg2 Nc6 d3 e5 O-O
DEBUG:chess.engine:<PopenProcess at 0x7fc564f74b00 (pid=31042)> >> 6 -36 5377 260090 Bg2 Nc6 d3 Qa5+ Bd2 Qd8
DEBUG:chess.engine:<PopenProcess at 0x7fc564f74b00 (pid=31042)> >> 7 -13 14976 1270843 Bg2 d3 O-O Bg4 Qb3 b6 Qd1
^C--- https://lichess.org/d3p0IL08/white Game over

Engine doesn't know that game is finished for time losses and resignations

Usually happens in faster time controls when someone gets flagged or the opponent resigns. The bot will continue trying to send moves to the server even though the game is finished. The Lichess API responds with a 400 status code.

Here's an example of trying to send a move after losing on time:

Game ply: 112, root temperature:  0.20 
ERROR:backoff:Backing off api_post(...) for 0.4s (requests.exceptions.HTTPError: 504 Server Error: Gateway Time-out for url: https://lichess.org/bot/game/8WvMMQje/move/d6d5)
ERROR:backoff:Giving up api_post(...) after 2 tries (requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://lichess.org/bot/game/8WvMMQje/move/d6d5)
Abandoning game due to connection error
Traceback (most recent call last):
  File "main.py", line 127, in play_game
    li.make_move(game.id, best_move)
  File "/home/francis/lichess-bot/lichess.py", line 64, in make_move
    return self.api_post(ENDPOINTS["move"].format(game_id, move))
  File "/home/francis/miniconda3/lib/python3.6/site-packages/backoff/_sync.py", line 99, in retry
    ret = target(*args, **kwargs)
  File "/home/francis/lichess-bot/lichess.py", line 54, in api_post
    response.raise_for_status()
  File "/home/francis/miniconda3/lib/python3.6/site-packages/requests/models.py", line 935, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://lichess.org/bot/game/8WvMMQje/move/d6d5
--- https://lichess.org//8WvMMQje/black Game over

Upgrading to Bot Account

New here, hope this is the right place to post this, sorry if not.

I followed directions to set up the bot but ran into a snag. First, when I created an access token, I didn't have an option to select "Play bot moves", only download/read/write and email.

When I got to: run python main.py -u, I got the following message:
Valid token!
Something went wrong! status_code: 404, response: 404 - Resource not found
This is not a bot account. Please upgrade your Lichess account to a bot account!

suggestion: optionally share eval of the position on request (and more interaction)

A user just suggested that to me on lichess - sounds like a nice-to-have. Something along the lines of

user: !eval
bot: +1.23 [78% winning chances]

While at it, one could think about a lot more (optional) user-bot-interaction. Even something like a training bot.

user: makes a bad move
bot: are you really sure? you could still take back..

Opening books

The engine is not using opening books, is there something more you have to do other than specifying the book name in config.yml?

Don't accept challenges automatically against a bot except when mode is casual

Feature request:
My bot is not designed to play against a bot, it is designed to play against humans. It is weak around 1800 CCRL 40/4, and I am not improving its strength instead am trying to make it weaker.

There are bots that challenges it on rated mode which I don't really like as I can test engine vs engine matches on my pc at anytime, so I have enough engine vs engine games. Bot that challenges it in casual mode is just fine of course.

Another idea could be to develop a lichess bot protocol altogether where bot and api will communicate.
Example if there is a challenge to my engine named my_engine the api will send to my_engine,

challenge type bot name eeee rating n mode rated

where:
type is the type of player can be [bot, human]
eeee is the name of the engine challenging my_engine
n is the rating of the eeee engine can be [none, integer]
mode can be [rated, casual]

note that,
challenge type bot name eeee rating n mode rated

can be expanded to include tc, example

challenge type bot name eeee rating n mode rated tc b32

where:
tc value b32 can be a code,
b32 = Blitz 3+2
b52 = Blitza 5+2

Or other coding system design, above is just an example.

my_engine understand this as eeee is challenging me and it is of type bot and has rating of n on a rated mode. With this info I can decide whether I will accept the challenge or decline it.

or if a human challenges my_engine, the api will send,

challenge type human name hhhh rating n mode rated

The bot my_engine can reply with,
reply accept challenge type human name hhhh rating n mode rated

where:
reply [accept, decline] would determine if the game is a go or not.

If reply value is accept, the api can proceed the match.

If value is decline, api will inform the challenger,

reply decline [some message]

This is just a general idea details is totaly different thing. Perhaps adapt existing rules in fics and probably improve it further.

Bot cannot be run just by opening "lichess-bot.py" as before

Before there was a file named main.py, and I could just click it two times, and the bot would be automatically enabled. But now I have to go to PowerShell, then do
cd "directory"
./.venv/Scripts/activate
python lichess-bot.py
every time. If I don't execute "./.venv/Scripts/activate" before, I get this:

Traceback (most recent call last):
File "lichess-bot.py", line 8, in
import lichess
File "E:\chess\lichess-bot-master\lichess.py", line 14, in
import backoff
ModuleNotFoundError: No module named 'backoff'
PS E:\chess\lichess-bot-master>

And for "./.venv/Scripts/activate" to be executed, scripts should be allowed on the computer, and this is potentially dangerous for the system.

Race conditon

version has a race condition where: game_ends -> challenge_received -> check queue in worker and queue is empty -> cheque workers in main loop, all are busy -> insert new challenge into queue -> worker returns
in that case, there is a challenge in the queue and the worker won't pick it up.

Client Error: Unauthorized for url: https://lichess.org/account/me

(.venv) PS C:\Users\nikla\Desktop\beabot> python main.py
. /|
. // o
. || .
) lichess-bot 0.10
. //
. )
_( Play on Lichess with a bot

ERROR:backoff:Giving up api_get(...) after 1 tries (requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://lichess.org/account/me)
Traceback (most recent call last):
File "main.py", line 240, in
user_profile = li.get_profile()
File "C:\Users\nikla\Desktop\beabot\lichess.py", line 96, in get_profile
profile = self.api_get(ENDPOINTS["profile"])
File "C:\Users\nikla\Desktop\beabot.venv\lib\site-packages\backoff_sync.py", line 99, in retry
ret = target(*args, **kwargs)
File "C:\Users\nikla\Desktop\beabot\lichess.py", line 52, in api_get
response.raise_for_status()
File "C:\Users\nikla\Desktop\beabot.venv\lib\site-packages\requests\models.py", line 935, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://lichess.org/account/me

Uci options don't work

I tried to change uci options:

ucioptions:
Threads: "1"
Hash: "1024"
Book File: "engines/book.bin"
Slow Mover: 10
Move Overhead: 5000

I tried also
Move Overhead: "5000" and "Move Overhead": 5000

I tried to add this in engine_wrapper.py with self.engine.setoption({"Move Overhead": 5000})

and in main.py with engine.send_line("setoption name Move Overhead value 5000")

But speed stays the same in all cases.

I tried different numbers, tried setting it to 0, to 1000. No effect.

Another ChunkedEncodingError

Strange thing happened last night wile i was sleeping. Here is the full log:

tamas@tami:~/lichess-bot$ python3 main.py -v
.   _/|
.  // o\
.  || ._)  lichess-bot 0.10
.  //__\
.  )___(   Play on Lichess with a bot

DEBUG:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): lichess.org
DEBUG:requests.packages.urllib3.connectionpool:https://lichess.org:443 "GET /account/me HTTP/1.1" 200 None
Welcome PyChessBot!
You're now connected to https://lichess.org/ and awaiting challenges.
DEBUG:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): lichess.org
DEBUG:requests.packages.urllib3.connectionpool:https://lichess.org:443 "GET /api/stream/event HTTP/1.1" 200 None
DEBUG:requests.packages.urllib3.connectionpool:Resetting dropped connection: lichess.org
DEBUG:requests.packages.urllib3.connectionpool:https://lichess.org:443 "POST /challenge/NTvSiJ1L/accept HTTP/1.1" 200 None
    Accept UltraBullet casual challenge from butterfly3(1370)
--- Process Queue. Total Queued: 1. Total Used: 0
--- Process Used. Total Queued: 0. Total Used: 1
DEBUG:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): lichess.org
DEBUG:requests.packages.urllib3.connectionpool:https://lichess.org:443 "GET /bot/game/stream/NTvSiJ1L HTTP/1.1" 400 None
Traceback (most recent call last):
  File "/home/tamas/lichess-bot/logging_pool.py", line 16, in __call__
    result = self.__callable(*args, **kwargs)
  File "main.py", line 103, in play_game
    game = model.Game(json.loads(next(updates).decode('utf-8')), user_profile["username"], li.baseUrl, config.get("abort_time", 20))
  File "/usr/lib/python3.5/json/__init__.py", line 319, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

DEBUG:requests.packages.urllib3.connectionpool:Resetting dropped connection: lichess.org
DEBUG:requests.packages.urllib3.connectionpool:https://lichess.org:443 "POST /challenge/aDjeMWPZ/accept HTTP/1.1" 200 None
    Accept UltraBullet casual challenge from butterfly3(1370)
--- Process Queue. Total Queued: 1. Total Used: 1
--- Process Used. Total Queued: 0. Total Used: 2
DEBUG:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): lichess.org
DEBUG:requests.packages.urllib3.connectionpool:https://lichess.org:443 "GET /bot/game/stream/aDjeMWPZ HTTP/1.1" 400 None
Traceback (most recent call last):
  File "/home/tamas/lichess-bot/logging_pool.py", line 16, in __call__
    result = self.__callable(*args, **kwargs)
  File "main.py", line 103, in play_game
    game = model.Game(json.loads(next(updates).decode('utf-8')), user_profile["username"], li.baseUrl, config.get("abort_time", 20))
  File "/usr/lib/python3.5/json/__init__.py", line 319, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

DEBUG:requests.packages.urllib3.connectionpool:Resetting dropped connection: lichess.org
DEBUG:requests.packages.urllib3.connectionpool:https://lichess.org:443 "POST /challenge/POO1FC9c/accept HTTP/1.1" 200 None
    Accept UltraBullet rated challenge from butterfly3(1370)
--- Process Queue. Total Queued: 1. Total Used: 2
--- Process Used. Total Queued: 0. Total Used: 3
DEBUG:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): lichess.org
DEBUG:requests.packages.urllib3.connectionpool:https://lichess.org:443 "GET /bot/game/stream/POO1FC9c HTTP/1.1" 400 None
Traceback (most recent call last):
  File "/home/tamas/lichess-bot/logging_pool.py", line 16, in __call__
    result = self.__callable(*args, **kwargs)
  File "main.py", line 103, in play_game
    game = model.Game(json.loads(next(updates).decode('utf-8')), user_profile["username"], li.baseUrl, config.get("abort_time", 20))
  File "/usr/lib/python3.5/json/__init__.py", line 319, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

DEBUG:requests.packages.urllib3.connectionpool:Resetting dropped connection: lichess.org
DEBUG:requests.packages.urllib3.connectionpool:https://lichess.org:443 "POST /challenge/ews3gxKx/accept HTTP/1.1" 200 None
    Accept UltraBullet rated challenge from butterfly3(1370)
--- Process Queue. Total Queued: 1. Total Used: 3
--- Process Used. Total Queued: 0. Total Used: 4
DEBUG:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): lichess.org
DEBUG:requests.packages.urllib3.connectionpool:https://lichess.org:443 "GET /bot/game/stream/ews3gxKx HTTP/1.1" 400 None
Traceback (most recent call last):
  File "/home/tamas/lichess-bot/logging_pool.py", line 16, in __call__
    result = self.__callable(*args, **kwargs)
  File "main.py", line 103, in play_game
    game = model.Game(json.loads(next(updates).decode('utf-8')), user_profile["username"], li.baseUrl, config.get("abort_time", 20))
  File "/usr/lib/python3.5/json/__init__.py", line 319, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Process Process-2:
Traceback (most recent call last):
  File "/home/tamas/.local/lib/python3.5/site-packages/requests/packages/urllib3/response.py", line 535, in _update_chunk_length
    self.chunk_left = int(line, 16)
ValueError: invalid literal for int() with base 16: b''

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/tamas/.local/lib/python3.5/site-packages/requests/packages/urllib3/response.py", line 298, in _error_catcher
    yield
  File "/home/tamas/.local/lib/python3.5/site-packages/requests/packages/urllib3/response.py", line 590, in read_chunked
    self._update_chunk_length()
  File "/home/tamas/.local/lib/python3.5/site-packages/requests/packages/urllib3/response.py", line 539, in _update_chunk_length
    raise httplib.IncompleteRead(line)
http.client.IncompleteRead: IncompleteRead(0 bytes read)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/tamas/.local/lib/python3.5/site-packages/requests/models.py", line 703, in generate
    for chunk in self.raw.stream(chunk_size, decode_content=True):
  File "/home/tamas/.local/lib/python3.5/site-packages/requests/packages/urllib3/response.py", line 428, in stream
    for line in self.read_chunked(amt, decode_content=decode_content):
  File "/home/tamas/.local/lib/python3.5/site-packages/requests/packages/urllib3/response.py", line 618, in read_chunked
    self._original_response.close()
  File "/usr/lib/python3.5/contextlib.py", line 77, in __exit__
    self.gen.throw(type, value, traceback)
  File "/home/tamas/.local/lib/python3.5/site-packages/requests/packages/urllib3/response.py", line 316, in _error_catcher
    raise ProtocolError('Connection broken: %r' % e, e)
requests.packages.urllib3.exceptions.ProtocolError: ('Connection broken: IncompleteRead(0 bytes read)', IncompleteRead(0 bytes read))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.5/multiprocessing/process.py", line 249, in _bootstrap
    self.run()
  File "/usr/lib/python3.5/multiprocessing/process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "main.py", line 35, in watch_control_stream
    for evnt in li.get_event_stream().iter_lines():
  File "/home/tamas/.local/lib/python3.5/site-packages/requests/models.py", line 747, in iter_lines
    for chunk in self.iter_content(chunk_size=chunk_size, decode_unicode=decode_unicode):
  File "/home/tamas/.local/lib/python3.5/site-packages/requests/models.py", line 706, in generate
    raise ChunkedEncodingError(e)
requests.exceptions.ChunkedEncodingError: ('Connection broken: IncompleteRead(0 bytes read)', IncompleteRead(0 bytes read))

Then I stopped, updated, and restarted my lichess-bot. I got this:

tamas@tami:~/lichess-bot$ python3 lichess-bot.py -v
.   _/|
.  // o\
.  || ._)  lichess-bot 0.11
.  //__\
.  )___(   Play on Lichess with a bot

DEBUG:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): lichess.org
DEBUG:requests.packages.urllib3.connectionpool:https://lichess.org:443 "GET /api/account HTTP/1.1" 200 None
Welcome PyChessBot!
You're now connected to https://lichess.org/ and awaiting challenges.
DEBUG:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): lichess.org
DEBUG:requests.packages.urllib3.connectionpool:https://lichess.org:443 "GET /api/stream/event HTTP/1.1" 200 None
Something went wrong. Game is starting and we don't have a queued process
--- Process Used. Total Queued: 0. Total Used: 1
DEBUG:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): lichess.org
DEBUG:requests.packages.urllib3.connectionpool:https://lichess.org:443 "GET /api/bot/game/stream/POO1FC9c HTTP/1.1" 200 None
DEBUG:chess.engine:<PopenProcess at 0x7ff0b0ab8978 (pid=10711)> << xboard
DEBUG:chess.engine:<PopenProcess at 0x7ff0b0ab8978 (pid=10711)> << protover 2
DEBUG:chess.engine:<PopenProcess at 0x7ff0b0ab8978 (pid=10711)> << post
DEBUG:chess.engine:<PopenProcess at 0x7ff0b0ab8978 (pid=10711)> << easy
DEBUG:chess.engine:<PopenProcess at 0x7ff0b0ab8978 (pid=10711)> << ping 123
DEBUG:chess.engine:<PopenProcess at 0x7ff0b0ab8978 (pid=10711)> >> # PyChess 0.99.1 [pypy3 3.5.3]
DEBUG:chess.engine:<PopenProcess at 0x7ff0b0ab8978 (pid=10711)> >> feature ping=1 setboard=1 playother=1 san=1 usermove=1 time=1 draw=1 sigint=0 sigterm=0 reuse=1 analyze=1 myname="PyChess 0.99.1" variants="normal,wildcastle,nocastle,fischerandom,crazyhouse,losers,suicide,giveaway,horde,atomic,racingkings,kingofthehill,3check,asean,cambodian,makruk,sittuyin" colors=0 ics=0 name=0 pause=0 nps=0 debug=1 memory=0 smp=0 egt="gaviota" option="skipPruneChance -slider 0 0 100"
DEBUG:chess.engine:<PopenProcess at 0x7ff0b0ab8978 (pid=10711)> >> feature done=1
DEBUG:chess.engine:<PopenProcess at 0x7ff0b0ab8978 (pid=10711)> >> pong 123
DEBUG:chess.engine:<PopenProcess at 0x7ff0b0ab8978 (pid=10711)> << egtpath gaviota ../Gaviota/Gaviota
DEBUG:chess.engine:<PopenProcess at 0x7ff0b0ab8978 (pid=10711)> << force
DEBUG:chess.engine:<PopenProcess at 0x7ff0b0ab8978 (pid=10711)> << setboard rnbqkbnr/pppppppp/8/8/3P4/8/PPP1PPPP/RNBQKBNR b KQkq - 0 1
+++ https://lichess.org/POO1FC9c/black UltraBullet vs butterfly3(1370)
DEBUG:chess.engine:<PopenProcess at 0x7ff0b0ab8978 (pid=10711)> << level 0 0:15 0
DEBUG:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): lichess.org
DEBUG:requests.packages.urllib3.connectionpool:https://lichess.org:443 "POST /api/bot/game/POO1FC9c/move/d7d5 HTTP/1.1" 200 None
--- https://lichess.org/POO1FC9c/black Game over
DEBUG:chess.engine:<PopenProcess at 0x7ff0b0ab8978 (pid=10711)> << quit
+++ Process Free. Total Queued: 0. Total Used: 0

Seems butterfly3 challenged 4 games 2 hours ago. 3 was aborted, but in game https://lichess.org/POO1FC9ctqYn 1. d4 d5 happened. It was not aborted contrary after I restarted pychess-bot this morning butterfly3 lost it on time.
My config.yml

token: "xxxxxxxxxxxxxxxx"    # lichess OAuth2 Token
url: "https://lichess.org/"  # lichess base URL

engine:                      # engine settings
  dir: "./engines/"          # dir containing engines, relative to this project
  name: "pychess-engine"     # binary name of the engine to use
  protocol: "xboard"         # "uci" or "xboard"
#  weights: "latest.txt"     # only if the engine is lczero
#  threads: 1                # only if the engine is lczero
  polyglot: true            # activate polyglot book
  polyglot_book: "dc-3200.bin"  # book file name, must be in engine.dir
  polyglot_max_depth: 8      # half move max depth
  polyglot_min_weight: 1     # best move weight
  polyglot_random: true      # select move randomly otherwise select by min weight

ucioptions:                  # arbitrary UCI options passed to the engine
  Move Overhead: 100         # increase if your bot flags games too often
#  Threads: 4
#  Hash: "4096"
#  Book File: "engines/book.bin"

xboardoptions:
#  memory: "4096"
#  cores: "4"
  egtpath:                   # type and dir of end game tablebases
    gaviota: "../Gaviota/Gaviota"
#    nalimov: "Nalimov Path"
#    scorpio: "Scorpio Path"
#    syzygy: "Syzygy Path"

max_concurrent_games: 4      # number of games to play simultaneously
sort_challenges_by: "rating" # possible values: "rating", "date"
abort_time: 20
accept_bot_challenges: false

supported_variants:          # chess variants to accept (http://lichess.org/variant)
  - standard
  - fromPosition
  - antichess
  - atomic
  - chess960
  - crazyhouse
  - horde
  - kingOfTheHill
  - racingKings
  - threeCheck

supported_tc:                # time controls to accept
  - ultraBullet
  - bullet
  - blitz
  - rapid
#  - classical
#  - correspondence

supported_modes:             # game modes to accept
  - casual                   # unrated games
  - rated                    # rated games - must comment if the engine doesn't try to win

print_engine_stats: true     # print engine stats on each move

lichess-bot causing lczero to crash

I dont know what is causing this but it doesnt happen when using lczero in any other way.
But lichess-bot is causing leela to spew out all the network values and then crash.
see image

yaml.scanner.ScannerError: while scanning a simple key

$ python3 main.py
Traceback (most recent call last):
  File "main.py", line 216, in <module>
    load_config()
  File "main.py", line 207, in load_config
    CONFIG = yaml.load(stream)
  File "/home/turing/.local/lib/python3.5/site-packages/yaml/__init__.py", line 72, in load
    return loader.get_single_data()
  File "/home/turing/.local/lib/python3.5/site-packages/yaml/constructor.py", line 35, in get_single_data
    node = self.get_single_node()
  File "/home/turing/.local/lib/python3.5/site-packages/yaml/composer.py", line 36, in get_single_node
    document = self.compose_document()
  File "/home/turing/.local/lib/python3.5/site-packages/yaml/composer.py", line 55, in compose_document
    node = self.compose_node(None, None)
  File "/home/turing/.local/lib/python3.5/site-packages/yaml/composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
  File "/home/turing/.local/lib/python3.5/site-packages/yaml/composer.py", line 127, in compose_mapping_node
    while not self.check_event(MappingEndEvent):
  File "/home/turing/.local/lib/python3.5/site-packages/yaml/parser.py", line 98, in check_event
    self.current_event = self.state()
  File "/home/turing/.local/lib/python3.5/site-packages/yaml/parser.py", line 428, in parse_block_mapping_key
    if self.check_token(KeyToken):
  File "/home/turing/.local/lib/python3.5/site-packages/yaml/scanner.py", line 116, in check_token
    self.fetch_more_tokens()
  File "/home/turing/.local/lib/python3.5/site-packages/yaml/scanner.py", line 159, in fetch_more_tokens
    self.stale_possible_simple_keys()
  File "/home/turing/.local/lib/python3.5/site-packages/yaml/scanner.py", line 289, in stale_possible_simple_keys
    "could not find expected ':'", self.get_mark())
yaml.scanner.ScannerError: while scanning a simple key
  in "./config.yml", line 4, column 1
could not find expected ':'
  in "./config.yml", line 5, column 3

config.yml:

token: "xxxxxxxxxxxxxxxx"    # lichess OAuth2 Token
url: "https://listage.ovh/"  # lichess base URL

engine {                     # engine settings
  dir: "./engines/"          # dir containing engines, relative to this project
  name: "stockfish"          # binary name of the engine to use
#  weights: "latest.txt"     # only if the engine is lczero
#  threads: 1                # only if the engine is lczero
}

max_concurrent_games: 1      # number of games to play simultaneously
max_queued_challenges: 0     # number of challenges to allow to queue

supported_variants:          # chess variants to accept (http://lichess.org/variant)
  - standard
#  - fromPosition
  - antichess
  - atomic
#  - chess960
  - crazyhouse
  - horde
  - kingOfTheHill
  - racingKings
  - threeCheck

supported_tc:                # time controls to accept
  - ultraBullet
  - bullet
  - blitz
  - rapid
#  - classical
#  - correspondence

supported_modes:             # game modes to accept
  - casual                   # unrated games
  - rated                    # rated games - must comment if the engine doesn't try to win

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.