Giter Club home page Giter Club logo

botli's Introduction

Overview

BotLi is a bot for Lichess. It connects any UCI engine with the Lichess Bot API.

It has a customizable support of Polyglot opening books, a variety of supported online opening books and an online endgame tablebase. It can query local Syzygy and Gaviota endgame tablebases.

In addition, BotLi can autonomously challenge other bots in any variant. It supports custom opening books and engines depending on color, time control and Lichess chess variant.

If you have found a bug, please create an issue. For discussion, feature requests and help join the BotLi Discord server.

How to install

  • NOTE: Only Python 3.10 or later is supported!
  • Download the repo into BotLi directory: git clone https://github.com/Torom/BotLi.git
  • Navigate to the directory in cmd/Terminal: cd BotLi
  • Copy config.yml.default to config.yml

Install all requirements:

python -m pip install -r requirements.txt
  • Customize the config.yml according to your needs.

Lichess OAuth

Setup Engine

A separate engine can be configured for each time control and variant. By appending _white or _black to the time control, variant, standard or variants, the engine can be configured for that color only.

Within the file config.yml:

  • Enter the directory containing the engine executable in the engine: dir field.
  • Enter the executable name in the engine: name field.
  • You need to adjust the settings in engine: uci_options depending on your system.

Setup opening book

To use an opening book, you have to enter a name of your choice and the path to the book at the end of the config in the books section.

In the upper opening_books: books section you only have to enter the name you just chose. In addition, different books can be used depending on the time control, white, black and for all variants. If no specific book is defined, the standard books are used for standard chess.

For example, the books section could look like this:

books:
  Goi: "./engines/Goi.bin"
  Perfect: "/home/Books/Perfect2021.bin"
  Cerebellum: "Cerebellum.bin"

A corresponding opening_books section could look like this:

opening_books:
  enabled: true
  priority: 400
  books:
    bullet_white:
      selection: uniform_random
      names:
        - Goi
    bullet_black:
      selection: best_move
      names:
        - Goi
        - Cerebellum
    standard:
      selection: weighted_random
      max_depth: 8
      names:
        - Cerebellum

How to control

Interactive mode

In this mode the bot is controlled by commands entered into the console.

Start

To start the bot, type:

python user_interface.py

The bot automatically accepts challenges. Which challenges are accepted is defined in the config in the section challenge.

To see all commands, type:

help

Matchmaking

To challenge other players with similar ratings, type:

matchmaking

Change the settings in matchmaking in the config to change how this bot challenges other players. The bot will pause matchmaking for incoming challenges. To exit the matchmaking mode type:

stop

To exit the bot completely, type:

quit

The bot will always wait until the current game is finished.

Non interactive mode

This mode is used automatically when BotLi is used without an interactive terminal, for example as a service. In this case, the bot is controlled by setting flags at start time.

Matchmaking

To let the bot challenge other bots in non interactive mode, start it like this:

python user_interface.py --matchmaking

CAUTION: Lichess will rate limit you if you let matchmaking run too long without adjusting the delay accordingly.

Upgrade to Bot account

When the bot is running in interactive mode it will ask for an account upgrade if necessary.

In non interactive mode the --upgrade flag must be set at start.

python user_interface.py --upgrade

The account cannot have played any game before becoming a Bot account. The upgrade is irreversible. The account will only be able to play as a Bot.

Running with Docker

The project comes with a Dockerfile, this uses python:3.12, installs all dependencies, downloads the latest version of Stockfish and starts the bot.

If Docker is used, all configurations must be done in config.yml.default. This is automatically renamed to config.yml in the build process.

The Dockerfile also contains all commands to download Fairy-Stockfish and all NNUEs needed for the Lichess chess variants. These commands must be uncommented if desired. In addition, the variants engine must be enabled in the config.yml.default. To use NNUE for the Lichess chess variants the following UCI option for Fairy-Stockfish must be set in the config: EvalFile: "3check-313cc226a173.nnue:antichess-689c016df8e0.nnue:atomic-2cf13ff256cc.nnue:crazyhouse-8ebf84784ad2.nnue:horde-28173ddccabe.nnue:kingofthehill-978b86d0e6a4.nnue:racingkings-636b95f085e3.nnue"

Running as a service

This is an example systemd service definition:

[Unit]
Description=BotLi
After=network-online.target
Wants=network-online.target

[Service]
Environment="PYTHONUNBUFFERED=1"
ExecStart=/usr/bin/python3 /home/ubuntu/BotLi/user_interface.py
WorkingDirectory=/home/ubuntu/BotLi
User=ubuntu
Group=ubuntu
Restart=always

[Install]
WantedBy=multi-user.target

If the service should run with matchmaking the --matchmaking flag must be appended at the end of the ExecStart line.

Note: If you want the bot to run in matchmaking mode for a long time, it is recommended to set the matchmaking delay higher to avoid problems with the Lichess rate limit. I recommend the following formula: delay = 430 - 2 * initial_time - 160 * increment

Acknowledgements

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 code which allows engine communication seamlessly. In addition, the idea of this bot is based on lichess-bot-devs/lichess-bot.

License

BotLi is licensed under the AGPLv3 (or any later version at your option). Check out the LICENSE file for the full text.

botli's People

Contributors

bknox83 avatar dependabot[bot] avatar m-dinhhoangviet avatar torom 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

botli's Issues

Is there a way?

Is there a way to increase node/NPS, hash and Depth calculated in BotLi ?

Add NNUE Eval for fsf

How do I add NNUE files in Dockerfile to make fairy stockfish stronger because its making too much blunders
image
And can it uses more than 1 eval file at once?
Thank

[enhancement] Add a delay before launching a challenge

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

Error when starting

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'_

[FIXED] Heroku problem

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

Not working

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'

Time control

Hey, how can I adjust my bot's accepted time control? I mean I have to adjust the minutes per side to 1 minute

Stockfish improvement

Can you help me how to get NNUE files to make stockfish dev better (standard) and antichess NNUE file for fsf pls

column tweak

It looks like if move time is over 1000 seconds that the columns for hash and tablebase hits become misaligned.
botli

New step

Torom can you try making the code compatible for cloudfare.com ?

How can we install python -m pip install -r requirements.txt

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

The Bot does not reply

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

image

!eval command

I think u should try to make it sends the results continuously
Just 1 !eval then it should sends all the moves ???

"!eval" command improvements

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

Variants

I really want the bot to support all lichess variants.
Do you have an idea for how to do it ?

Help config.yml

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

Something unclear

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

clean install BotLI not working

Describe the bug
After installing BotLi does not work

To Reproduce
Steps to reproduce the behavior:

  1. git clone https://github.com/Torom/BotLi.git
  2. cd BotLi
  3. Copy config.yml.default to config.yml
  4. python -m pip install -r requirements.txt
  5. Customize the config.yml
  6. python user_interface.py

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:

  • OS: Linux raspberrypi4 5.15.74-v8+ #1595 SMP PREEMPT Wed Oct 26 11:07:24 BST 2022 aarch64 GNU/Linux
  • Python 3.9.2 (default, Feb 28 2021, 17:03:44)
  • Engine: stockfish
  • Locally / Cloud: Localy

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"

challenge error

Idk how to fix this:
challenge RaspFish [60] [1] [White] [RATED] [standrard]
invalid literal for int() with base 10: '[10]'

Run at a same time

How can I run stockfish and fairy-stockfish at a same time? Is it possible? Thanks
I tried to edit the Dockerfile

books section

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.

Horde variant

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)

Strength

I want to know how to increase my bot's strength and why it times out quite often while playing with AI level 8 ?

Help me ๐Ÿค™

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'

Um. help?

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

Older stockfish versons

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

NNUE using

Hey author,
Please tell me how to use NNUE on the bot please
Thank you

Variant engine

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

Something wrong with BotLi ?

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

No Idea ?

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'))

Merging

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

Error ?

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

Future plans for BotLi on a Cloud Server

Uh Hi, @Torom
In 25/Aug/22 when on Heroku web, I saw this:
image
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,

Variants error ?

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.

Hmm problem ?

Hello, I guess there is a problem with matchmaking.py.
My bot does not challenge anyone (on Heroku)
image
image
doesnt challenges anyone

Help

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)

not working with linux

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'

Not Working properly on Heroku

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???

Misunderstanding problem

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

How to setup LC0 TO botli and Botli Heroku??

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

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.