How to create a Lichess BOT

Moderators: Elijah, Igbo, timetraveller

IbaiBuR

Top contribute Forum
Administrators
Points: 7 707,00 
Forum Contributions
Posts: 149
Joined: 05/01/2021, 15:29
Status: Offline (Active 14 Hours, 19 Minutes ago)
Medals: 1
Topics: 6
Reputation: 252
Location: Madrid, ES
Has thanked: 64 times
Been thanked: 319 times

How to create a Lichess BOT

Post by IbaiBuR »

In this topic I plan to share an step by step guide on how to create a Lichess BOT account to be able to play in the Lichess Server against other bots, lets start.

Even if you already have a Lichess account, I suggest you to create a new one, whose username will be the name of the BOT. It is worth noting that if you already had a Lichess account you should use a different email for the bot account. Go here to create the Lichess account that will be used for your BOT.

After this, you have to choose the software that will be used to connect your PC to the server. There are many implementations, but the one I highly recommend is this one: BotLi as it is highly customizable, it lets you run different engines per color and time control, specific books per color and time control, online opening explorer, ChessDB, SyzygyTB...

So firstly, either download the code from the BotLi github repository or git clone it to the folder you want to have the BOT in your PC. BotLi only supports Python3.10 or higher, so if you have an older version you should update it.
Image

After downloading the code, unzip it in your folder of preference, it should look like this:

Image

In order to continue, you should now create the personal API Access Token of your BOT. This is very important as it is the way the BOT has to authenticate and login into the server. To do this, login into your newly created BOT account, click on your username, then on preferences and scroll down to Personal API access tokens. Click on the "+" symbol, give a name to your token and enable the necessary permissions, in particular you must enable the "Play with the BOT API" one (bot:play). for example:

Image

After you click on create your token will be generated, it is highly advisable to save it somewhere in a secure way. Do not share your token with anyone and try to keep it as safe as possible, because if anyone gets access to your token it will have access directly to your account, so be careful!

Now its time to start configuring the BOT:
1. Go to the unzipped BotLi folder and place the engine and the opening book / books in the "engines" folder
2. Use a code editor such a Notepad++ to modify the config.yml.default file

Some steps to do this:
- Open the config.yml.default file with a code editor and start by replacing the XXX.. in the token section with your newly created token, then continue configuring the UCI options, SyzygyPaths and the book / books you want to use in the book section. For example:

Image

This would be the corresponding code to run Stockfish with 8 threads, 1024MB of Hash, 1000 Move Overhead and configure 5 man Syzygy Tablebases:

Code: Select all

engines:
  standard:                               # Engine used for standard chess and when no suitable special engine is configured.
    dir: "./engines"                      # Directory containing the engine.
    name: "stockfish.exe"                  # Binary name of the engine to use.
    ponder: true                          # Think on opponent's time.
    use_syzygy: true                      # Whether the engine should be configured to use syzygy.
    silence_stderr: false                 # Suppresses stderr output.
    uci_options:                          # Arbitrary UCI options passed to the engine. (Commenting allowed)
      Threads: 8                          # Max CPU threads the engine can use.
      Hash: 1024                          # Max memory (in megabytes) the engine can allocate.
      Move Overhead: 1000                 # Increase if your bot flags games too often.
      
syzygy:
  enabled: true                          # Activate local syzygy endgame tablebases.
  paths:                                  # Paths to local syzygy endgame tablebases.
    - "C:/3-4-5"
  max_pieces: 5                           # 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.
An example of the opening books config:

Code: Select all

opening_books:
  enabled: true                           # Activate opening books.
  priority: 400                           # Priority with which this move source is used. Higher priority is used first.
  books:
    standard_white:
      selection: weighted_random          # Move selection is one of "weighted_random", "uniform_random" or "best_move".
      names:
        - "WhiteBook1"
        - "WhiteBook2"  
    standard_black:
      selection: best_move               # Move selection is one of "weighted_random", "uniform_random" or "best_move".
      names:
        - "BlackBook1"  
        - "BlackBook2"
The comments in the config file will help you with this. I also recommend you to enable online_egtb to have access to online 7 man Syzygy Tablebases.

In the challenge section of the config file you should decide what challenges you want your bot to accept, imagine you want the bot to play from bullet to classical, with a minimum time control of 60s+0 seconds increment to a maximum of 30 minutes+ 5seconds increment, it would look like this:

Code: Select all

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: 0                        # Minimum amount of increment to accept a challenge.
  max_increment: 5                       # Maximum amount of increment to accept a challenge.
  min_initial: 60                          # Minimum amount of initial time to accept a challenge.
  max_initial: 1800                  # 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:                          # Speeds or time controls in initial_minutes+increment_seconds format 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
Again this is intuitive and you can customize it for your own needs and preferences. Next step is to set up the matchmaking part, which will determine the time controls your bots will use to challenge other bots. I recommend you to set a delay higher than 90 to avoid reaching Lichess Rate Limit. For example, to let your bot challenge other bots at 1+1, 3+0 and 8+0 timecontrols it should look like this:

Code: Select all

matchmaking:
  delay: 120                              # Time in seconds the bot must be idle before a new challenge is started.
  timeout: 30                             # Time until a challenge is canceled.
  types:                                  # Matchmaking types of which one is randomly selected before each game.
    bullet:                               # Arbitrary name of the matchmaking type. Names must be unique.
      tc: 1+1                             # Time control in initial_minutes+increment_seconds format.
      rated: true                         # Whether matchmaking should play rated games.
      variant: standard                   # Chess variant (https://lichess.org/variant) to challenge.
      weight: 40                          # Weight with which this type is selected. (Default: 100)
      multiplier: 20                      # Multiplier for calculating timeouts in matchmaking. Higher values lead to a wider range of opponents.
      max_rating_diff: 200
    blitz:                                # Arbitrary name of the matchmaking type. Names must be unique.
      tc: 3+0                             # Time control in initial_minutes+increment_seconds format.
      rated: true                         # Whether matchmaking should play rated games.
      variant: standard                   # Chess variant (https://lichess.org/variant) to challenge.
      weight: 35                          # Weight with which this type is selected. (Default: 100)
      multiplier: 20                      # Multiplier for calculating timeouts in matchmaking. Higher values lead to a wider range of opponents.
      max_rating_diff: 200
    rapid:                                # Arbitrary name of the matchmaking type. Names must be unique.
      tc: 8+0                             # Time control in initial_minutes+increment_seconds format.
      rated: true                         # Whether matchmaking should play rated games.
      variant: standard                   # Chess variant (https://lichess.org/variant) to challenge.
      weight: 25                          # Weight with which this type is selected. (Default: 100)
      multiplier: 20                      # Multiplier for calculating timeouts in matchmaking. Higher values lead to a wider range of opponents.
      max_rating_diff: 250
 
The weight determines how much your bot will select a time control to challenge other bots, change it for your own needs. Also, I enable max_rating_diff to play only with strong bots, if you want to remove it is your choice.

To finish with the config, modify the book paths and names according to the book section you previously modified, for example:

Code: Select all

books:                                    # Names of the opening books (to be used above in the opening_books section) and paths to the opening books.
  WhiteBook1: "C:/BotLi/engines/wbook1.bin"
  WhiteBook2: "C:/BotLi/engines/wbook2.bin"
  BlackBook1: "C:/BotLi/engines/blackbook1.bin"
  BlackBook2: "C:/BotLi/engines/blackbook2.bin"
After this, your bot should be finally configured!. Now save the config.yml.default file only as config.yml (or rename it to config.yml).

The last step is to start the bot, upgrade it to BOT account, run it in matchmaking mode and start playing (remember you need Python3.10 at least). To do that:

1. Launch a CMD / Terminal in the BotLi folder
2. Type-> python -m pip install -r requirements.txt
3. Run the bot in matchmaking mode-> python user_interface.py -m

To simplify that you can create an script that does it all with just double-clicking it, it looks like this:

Code: Select all

python -m pip install -r requirements.txt
cls
python user_interface.py -m
EmptikBest

Book Maker
Forum Contributions
Points: 16 218,00 
Posts: 401
Joined: 05/07/2023, 13:58
Status: Offline (Active 3 Days, 7 Hours, 50 Minutes ago)
Medals: 1
Topics: 12
Reputation: 209
Has thanked: 29 times
Been thanked: 479 times

How to create a Lichess BOT

Post by EmptikBest »

Also, here you can find a lot of BIN books for your lichess bot, be careful on which ones to pick though thumbsup lol
Igbo

Top contribute Forum Book Maker
Global moderators
Points: 78 856,00 
Forum Contributions
Posts: 670
Joined: 21/03/2022, 20:57
Status: Offline (Active 5 Hours, 49 Minutes ago)
Medals: 2
Topics: 41
Reputation: 2961
Location: terrassa, Spain
Has thanked: 700 times
Been thanked: 4044 times

How to create a Lichess BOT

Post by Igbo »

Well, thank goodness we have this guide, because with the closure of infinitychess, apart from playchess, there is only this server left to leave the program on. Well let's see if we clarify ourselves. The email thing is the only thing I'm clear about, the rest seems difficult to me. Let's try.
I am not an expert in anything, I do not believe in anything, but everything is possible.
Igbo

Top contribute Forum Book Maker
Global moderators
Points: 78 856,00 
Forum Contributions
Posts: 670
Joined: 21/03/2022, 20:57
Status: Offline (Active 5 Hours, 49 Minutes ago)
Medals: 2
Topics: 41
Reputation: 2961
Location: terrassa, Spain
Has thanked: 700 times
Been thanked: 4044 times

How to create a Lichess BOT

Post by Igbo »

Code: Select all

D:\lichessBoth\BotLi-main>python user_interface.py -m

Python not found; run without arguments to install from the Microsoft Store or disable this shortcut in Settings > Manage app launch aliases.

D:\lichessBoth\BotLi-main>
Image

I have ls version 3.11 installed. Do I have to add it to the path of the variable and restart the server? So far all the previous steps have gone well. Thanks in advance.
I am not an expert in anything, I do not believe in anything, but everything is possible.
IbaiBuR

Top contribute Forum
Administrators
Points: 7 707,00 
Forum Contributions
Posts: 149
Joined: 05/01/2021, 15:29
Status: Offline (Active 14 Hours, 19 Minutes ago)
Medals: 1
Topics: 6
Reputation: 252
Location: Madrid, ES
Has thanked: 64 times
Been thanked: 319 times

How to create a Lichess BOT

Post by IbaiBuR »

Igbo wrote: 14/09/2023, 20:24

Code: Select all

D:\lichessBoth\BotLi-main>python user_interface.py -m

Python not found; run without arguments to install from the Microsoft Store or disable this shortcut in Settings > Manage app launch aliases.

D:\lichessBoth\BotLi-main>
Image

I have ls version 3.11 installed. Do I have to add it to the path of the variable and restart the server? So far all the previous steps have gone well. Thanks in advance.
Yes I forgot to mention that, Python needs to be in path. There is an option to do it automatically during installation, but it is relatively easy to do it anyways if you have installed it and it is not in path.

lf you have any other problems just tell me :)
Igbo

Top contribute Forum Book Maker
Global moderators
Points: 78 856,00 
Forum Contributions
Posts: 670
Joined: 21/03/2022, 20:57
Status: Offline (Active 5 Hours, 49 Minutes ago)
Medals: 2
Topics: 41
Reputation: 2961
Location: terrassa, Spain
Has thanked: 700 times
Been thanked: 4044 times

How to create a Lichess BOT

Post by Igbo »

IbaiBuR wrote: 14/09/2023, 21:17
Igbo wrote: 14/09/2023, 20:24

Code: Select all

D:\lichessBoth\BotLi-main>python user_interface.py -m

Python not found; run without arguments to install from the Microsoft Store or disable this shortcut in Settings > Manage app launch aliases.

D:\lichessBoth\BotLi-main>
Image

I have ls version 3.11 installed. Do I have to add it to the path of the variable and restart the server? So far all the previous steps have gone well. Thanks in advance.
Yes I forgot to mention that, Python needs to be in path. There is an option to do it automatically during installation, but it is relatively easy to do it anyways if you have installed it and it is not in path.

lf you have any other problems just tell me :)

Code: Select all

D:\lichessBoth\BotLi-main>python user_interface.py -m
There appears to be a syntax problem with your config.yml
Traceback (most recent call last):
  File "D:\lichessBoth\BotLi-main\user_interface.py", line 315, in <module>
    ui = UserInterface(args.config, args.matchmaking, args.upgrade)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\lichessBoth\BotLi-main\user_interface.py", line 43, in __init__
    self.config = load_config(config_path)
                  ^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\lichessBoth\BotLi-main\config.py", line 15, in load_config
    raise e
  File "D:\lichessBoth\BotLi-main\config.py", line 12, in load_config
    config = yaml.safe_load(yml_input)
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\yaml\__init__.py", line 125, in safe_load
    return load(stream, SafeLoader)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\yaml\__init__.py", line 81, in load
    return loader.get_single_data()
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\yaml\constructor.py", line 49, in get_single_data
    node = self.get_single_node()
           ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\yaml\composer.py", line 36, in get_single_node
    document = self.compose_document()
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\yaml\composer.py", line 55, in compose_document
    node = self.compose_node(None, None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\yaml\composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\yaml\composer.py", line 133, in compose_mapping_node
    item_value = self.compose_node(node, item_key)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\yaml\composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\yaml\composer.py", line 133, in compose_mapping_node
    item_value = self.compose_node(node, item_key)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\yaml\composer.py", line 82, in compose_node
    node = self.compose_sequence_node(anchor)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\yaml\composer.py", line 110, in compose_sequence_node
    while not self.check_event(SequenceEndEvent):
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\yaml\parser.py", line 98, in check_event
    self.current_event = self.state()
                         ^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\yaml\parser.py", line 379, in parse_block_sequence_first_entry
    return self.parse_block_sequence_entry()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\yaml\parser.py", line 384, in parse_block_sequence_entry
    if not self.check_token(BlockEntryToken, BlockEndToken):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\yaml\scanner.py", line 116, in check_token
    self.fetch_more_tokens()
  File "C:\Program Files\Python311\Lib\site-packages\yaml\scanner.py", line 251, in fetch_more_tokens
    return self.fetch_double()
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\yaml\scanner.py", line 655, in fetch_double
    self.fetch_flow_scalar(style='"')
  File "C:\Program Files\Python311\Lib\site-packages\yaml\scanner.py", line 666, in fetch_flow_scalar
    self.tokens.append(self.scan_flow_scalar(style))
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\yaml\scanner.py", line 1149, in scan_flow_scalar
    chunks.extend(self.scan_flow_scalar_non_spaces(double, start_mark))
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\yaml\scanner.py", line 1223, in scan_flow_scalar_non_spaces
    raise ScannerError("while scanning a double-quoted scalar", start_mark,
yaml.scanner.ScannerError: while scanning a double-quoted scalar
  in "config.yml", line 31, column 7
found unknown escape character '3'
  in "config.yml", line 31, column 12

D:\lichessBoth\BotLi-main>





I uninstalled it and when I reinstalled I told it to add it to the variable path and with your script, the first time! Thank you Ibai
I am not an expert in anything, I do not believe in anything, but everything is possible.
EmptikBest

Book Maker
Forum Contributions
Points: 16 218,00 
Posts: 401
Joined: 05/07/2023, 13:58
Status: Offline (Active 3 Days, 7 Hours, 50 Minutes ago)
Medals: 1
Topics: 12
Reputation: 209
Has thanked: 29 times
Been thanked: 479 times

How to create a Lichess BOT

Post by EmptikBest »

Igbo wrote: 14/09/2023, 21:53
IbaiBuR wrote: 14/09/2023, 21:17
Igbo wrote: 14/09/2023, 20:24

Code: Select all

D:\lichessBoth\BotLi-main>python user_interface.py -m

Python not found; run without arguments to install from the Microsoft Store or disable this shortcut in Settings > Manage app launch aliases.

D:\lichessBoth\BotLi-main>
Image

I have ls version 3.11 installed. Do I have to add it to the path of the variable and restart the server? So far all the previous steps have gone well. Thanks in advance.
Yes I forgot to mention that, Python needs to be in path. There is an option to do it automatically during installation, but it is relatively easy to do it anyways if you have installed it and it is not in path.

lf you have any other problems just tell me :)

Code: Select all

D:\lichessBoth\BotLi-main>python user_interface.py -m
There appears to be a syntax problem with your config.yml
Traceback (most recent call last):
  File "D:\lichessBoth\BotLi-main\user_interface.py", line 315, in <module>
    ui = UserInterface(args.config, args.matchmaking, args.upgrade)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\lichessBoth\BotLi-main\user_interface.py", line 43, in __init__
    self.config = load_config(config_path)
                  ^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\lichessBoth\BotLi-main\config.py", line 15, in load_config
    raise e
  File "D:\lichessBoth\BotLi-main\config.py", line 12, in load_config
    config = yaml.safe_load(yml_input)
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\yaml\__init__.py", line 125, in safe_load
    return load(stream, SafeLoader)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\yaml\__init__.py", line 81, in load
    return loader.get_single_data()
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\yaml\constructor.py", line 49, in get_single_data
    node = self.get_single_node()
           ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\yaml\composer.py", line 36, in get_single_node
    document = self.compose_document()
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\yaml\composer.py", line 55, in compose_document
    node = self.compose_node(None, None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\yaml\composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\yaml\composer.py", line 133, in compose_mapping_node
    item_value = self.compose_node(node, item_key)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\yaml\composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\yaml\composer.py", line 133, in compose_mapping_node
    item_value = self.compose_node(node, item_key)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\yaml\composer.py", line 82, in compose_node
    node = self.compose_sequence_node(anchor)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\yaml\composer.py", line 110, in compose_sequence_node
    while not self.check_event(SequenceEndEvent):
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\yaml\parser.py", line 98, in check_event
    self.current_event = self.state()
                         ^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\yaml\parser.py", line 379, in parse_block_sequence_first_entry
    return self.parse_block_sequence_entry()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\yaml\parser.py", line 384, in parse_block_sequence_entry
    if not self.check_token(BlockEntryToken, BlockEndToken):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\yaml\scanner.py", line 116, in check_token
    self.fetch_more_tokens()
  File "C:\Program Files\Python311\Lib\site-packages\yaml\scanner.py", line 251, in fetch_more_tokens
    return self.fetch_double()
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\yaml\scanner.py", line 655, in fetch_double
    self.fetch_flow_scalar(style='"')
  File "C:\Program Files\Python311\Lib\site-packages\yaml\scanner.py", line 666, in fetch_flow_scalar
    self.tokens.append(self.scan_flow_scalar(style))
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\yaml\scanner.py", line 1149, in scan_flow_scalar
    chunks.extend(self.scan_flow_scalar_non_spaces(double, start_mark))
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\yaml\scanner.py", line 1223, in scan_flow_scalar_non_spaces
    raise ScannerError("while scanning a double-quoted scalar", start_mark,
yaml.scanner.ScannerError: while scanning a double-quoted scalar
  in "config.yml", line 31, column 7
found unknown escape character '3'
  in "config.yml", line 31, column 12

D:\lichessBoth\BotLi-main>





I uninstalled it and when I reinstalled I told it to add it to the variable path and with your script, the first time! Thank you Ibai
Seems there is a problem with your config.yml..

Could you please send it here or by PM with the token removed?
Igbo

Top contribute Forum Book Maker
Global moderators
Points: 78 856,00 
Forum Contributions
Posts: 670
Joined: 21/03/2022, 20:57
Status: Offline (Active 5 Hours, 49 Minutes ago)
Medals: 2
Topics: 41
Reputation: 2961
Location: terrassa, Spain
Has thanked: 700 times
Been thanked: 4044 times

How to create a Lichess BOT

Post by Igbo »

Code: Select all

D:\BotLi-main>python user_interface.py -m
Traceback (most recent call last):
  File "D:\BotLi-main\user_interface.py", line 7, in <module>
    from api import API
  File "D:\BotLi-main\api.py", line 6, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'

D:\BotLi-main>
I have reinstalled python, because they sent me a config.yml and now I only get those errors. Looks like we're almost there. Excuse my clumsiness, but I don't understand anything about this. And it is not very intuitive either, although it seems that with the token in place, so many errors no longer appear, as I mentioned before. For now I leave the engine in playchess, but I would like to leave it here, because we return to the same thing, you connect from cmd, and therefore I understand that you consume less hardware resources than through a gui. Thanks in advance and happy weekend to all the forum colleagues.
I am not an expert in anything, I do not believe in anything, but everything is possible.
EmptikBest

Book Maker
Forum Contributions
Points: 16 218,00 
Posts: 401
Joined: 05/07/2023, 13:58
Status: Offline (Active 3 Days, 7 Hours, 50 Minutes ago)
Medals: 1
Topics: 12
Reputation: 209
Has thanked: 29 times
Been thanked: 479 times

How to create a Lichess BOT

Post by EmptikBest »

Igbo wrote: 16/09/2023, 16:19

Code: Select all

D:\BotLi-main>python user_interface.py -m
Traceback (most recent call last):
  File "D:\BotLi-main\user_interface.py", line 7, in <module>
    from api import API
  File "D:\BotLi-main\api.py", line 6, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'

D:\BotLi-main>
I have reinstalled python, because they sent me a config.yml and now I only get those errors. Looks like we're almost there. Excuse my clumsiness, but I don't understand anything about this. And it is not very intuitive either, although it seems that with the token in place, so many errors no longer appear, as I mentioned before. For now I leave the engine in playchess, but I would like to leave it here, because we return to the same thing, you connect from cmd, and therefore I understand that you consume less hardware resources than through a gui. Thanks in advance and happy weekend to all the forum colleagues.
You need to install the requirements... "python -m pip install -r requirements.txt" should do the trick I think...
Igbo

Top contribute Forum Book Maker
Global moderators
Points: 78 856,00 
Forum Contributions
Posts: 670
Joined: 21/03/2022, 20:57
Status: Offline (Active 5 Hours, 49 Minutes ago)
Medals: 2
Topics: 41
Reputation: 2961
Location: terrassa, Spain
Has thanked: 700 times
Been thanked: 4044 times

How to create a Lichess BOT

Post by Igbo »

Code: Select all

D:\BotLi-main>python user_interface.py -m
There appears to be a syntax problem with your config.yml
Traceback (most recent call last):
  File "D:\BotLi-main\user_interface.py", line 315, in <module>
    ui = UserInterface(args.config, args.matchmaking, args.upgrade)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\BotLi-main\user_interface.py", line 43, in __init__
    self.config = load_config(config_path)
                  ^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\BotLi-main\config.py", line 15, in load_config
    raise e
  File "D:\BotLi-main\config.py", line 12, in load_config
    config = yaml.safe_load(yml_input)
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Lib\site-packages\yaml\__init__.py", line 125, in safe_load
    return load(stream, SafeLoader)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Lib\site-packages\yaml\__init__.py", line 81, in load
    return loader.get_single_data()
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Lib\site-packages\yaml\constructor.py", line 49, in get_single_data
    node = self.get_single_node()
           ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Lib\site-packages\yaml\composer.py", line 36, in get_single_node
    document = self.compose_document()
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Lib\site-packages\yaml\composer.py", line 55, in compose_document
    node = self.compose_node(None, None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Lib\site-packages\yaml\composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Lib\site-packages\yaml\composer.py", line 133, in compose_mapping_node
    item_value = self.compose_node(node, item_key)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Lib\site-packages\yaml\composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Lib\site-packages\yaml\composer.py", line 133, in compose_mapping_node
    item_value = self.compose_node(node, item_key)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Lib\site-packages\yaml\composer.py", line 82, in compose_node
    node = self.compose_sequence_node(anchor)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Lib\site-packages\yaml\composer.py", line 110, in compose_sequence_node
    while not self.check_event(SequenceEndEvent):
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Lib\site-packages\yaml\parser.py", line 98, in check_event
    self.current_event = self.state()
                         ^^^^^^^^^^^^
  File "C:\Program Files\Lib\site-packages\yaml\parser.py", line 379, in parse_block_sequence_first_entry
    return self.parse_block_sequence_entry()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Lib\site-packages\yaml\parser.py", line 384, in parse_block_sequence_entry
    if not self.check_token(BlockEntryToken, BlockEndToken):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Lib\site-packages\yaml\scanner.py", line 116, in check_token
    self.fetch_more_tokens()
  File "C:\Program Files\Lib\site-packages\yaml\scanner.py", line 251, in fetch_more_tokens
    return self.fetch_double()
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Lib\site-packages\yaml\scanner.py", line 655, in fetch_double
    self.fetch_flow_scalar(style='"')
  File "C:\Program Files\Lib\site-packages\yaml\scanner.py", line 666, in fetch_flow_scalar
    self.tokens.append(self.scan_flow_scalar(style))
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Lib\site-packages\yaml\scanner.py", line 1149, in scan_flow_scalar
    chunks.extend(self.scan_flow_scalar_non_spaces(double, start_mark))
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Lib\site-packages\yaml\scanner.py", line 1223, in scan_flow_scalar_non_spaces
    raise ScannerError("while scanning a double-quoted scalar", start_mark,
yaml.scanner.ScannerError: while scanning a double-quoted scalar
  in "config.yml", line 31, column 7
found unknown escape character '3'
  in "config.yml", line 31, column 11


D:\BotLi-main>

Code: Select all

token: "xxxxxxxxxx"         # Lichess OAuth2 Token.

engines:
  standard:                               # Engine used for standard chess and when no suitable special engine is configured.
    dir: "./engines"                      # Directory containing the engine.
    name: "EMAN 9.41 64-bit SSE41 POPCNT.exe"                     # Binary name of the engine to use.
    ponder: true                          # Think on opponent's time.
    use_syzygy: true                      # Whether the engine should be configured to use syzygy.
    silence_stderr: false                 # Suppresses stderr output.
    uci_options:                          # Arbitrary UCI options passed to the engine. (Commenting allowed)
      Threads: 36                         # Max CPU threads the engine can use.
      Hash: 4096                         # Max memory (in megabytes) the engine can allocate.
      Move Overhead: 600                 # Increase if your bot flags games too often.
# variants:                               # Engine used for variants when no suitable special engine is configured.
#   dir: "./engines"                      # Directory containing the engine.
#   name: "fairy-EMAN 9.41 64-bit SSE41 POPCNT.exe"               # Binary name of the engine to use.
#   ponder: true                          # Think on opponent's time.
#   use_syzygy: false                     # Whether the engine should be configured to use syzygy.
#   silence_stderr: false                 # Suppresses stderr output.
#   uci_options:                          # Arbitrary UCI options passed to the engine. (Commenting allowed)
#     Threads: 36                          # Max CPU threads the engine can use.
#     Hash: 4096                         # Max memory (in megabytes) the engine can allocate.
#     Move Overhead: 600                  # Increase if your bot flags games too often.
# Use the same pattern for 'bullet', 'blitz', 'rapid', 'classical',
# 'antichess', 'atomic', 'chess960', 'crazyhouse', 'horde', 'kingofthehill', 'racingkings' and '3check' as well.
# Append '_white' or '_black' to use the engine only as the specific color.

syzygy:
  enabled: false                          # Activate local syzygy endgame tablebases.
  paths:                                  # Paths to local syzygy endgame tablebases.
    - "C:\3-4-5"
  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.

opening_books:
  enabled: false                          # Activate opening books.
  priority: 400                           # Priority with which this move source is used. Higher priority is used first.
  books:
#   bullet:
#     selection: weighted_random          # Move selection is one of "weighted_random", "uniform_random" or "best_move".
#     names:                              # List of names of books to use in bullet.
#       - Eman
#       - Eman
#   standard_black:
#     selection: best_move                # Move selection is one of "weighted_random", "uniform_random" or "best_move".
#     names:                              # List of names of books to use as black.
#       - Eman
    standard:
      selection: weighted_random          # Move selection is one of "weighted_random", "uniform_random" or "best_move".
#     max_depth: 50                       # Half move max depth. (Comment this line for max depth)
      names:                              # List of names of books to use if there is no specific book for the time control, white, black or chess960.
        - Eman
#   Use the same pattern for 'bullet', 'blitz', 'rapid', 'classical',
#   'antichess', 'atomic', 'chess960', 'crazyhouse', 'horde', 'kingofthehill', 'racingkings' and '3check' as well.
#   Append '_white' or '_black' to use the books only as the specific color.

online_moves:
  opening_explorer:
    enabled: false                        # Activate online moves from Lichess opening explorer. The move that has performed best for this bot is played.
    priority: 300                         # Priority with which this move source is used. Higher priority is used first.
    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".
    anti: false                           # Whether to play the moves in which the opponent performs the worst.
#   max_depth: 16                         # Half move max depth. (Comment this line for max depth)
#   max_moves: 1                          # Max number of moves played from Lichess opening explorer. (Comment this line for max moves)
  lichess_cloud:
    enabled: false                        # Activate online moves from Lichess cloud eval.
    priority: 200                         # Priority with which this move source is used. Higher priority is used first.
    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)
#   max_moves: 1                          # Max number of moves played from Lichess cloud eval. (Comment this line for max moves)
  chessdb:
    enabled: false                        # Activate online moves from https://chessdb.cn/queryc_en/
    priority: 100                         # Priority with which this move source is used. Higher priority is used first.
    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)
#   max_moves: 1                          # Max number of moves played from chessdb. (Comment this line for max moves)
  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: 0                    # Minimum amount of increment to accept a challenge.
# max_increment: 5                      # Maximum amount of increment to accept a challenge.
# min_initial: 60                         # Minimum amount of initial time to accept a challenge.
# max_initial: 1800                 # 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:                          # Speeds or time controls in initial_minutes+increment_seconds format to accept.
    - bullet
    - blitz
    - rapid
#   - classical
#   - 25+0
  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

bullet:                               # Arbitrary name of the matchmaking type. Names must be unique.
      tc: 1+1                             # Time control in initial_minutes+increment_seconds format.
      rated: true                         # Whether matchmaking should play rated games.
      variant: standard                   # Chess variant (https://lichess.org/variant) to challenge.
      weight: 40                          # Weight with which this type is selected. (Default: 100)
      multiplier: 20                      # Multiplier for calculating timeouts in matchmaking. Higher values lead to a wider range of opponents.
      max_rating_diff: 200
    blitz:                                # Arbitrary name of the matchmaking type. Names must be unique.
      tc: 3+0                             # Time control in initial_minutes+increment_seconds format.
      rated: true                         # Whether matchmaking should play rated games.
      variant: standard                   # Chess variant (https://lichess.org/variant) to challenge.
      weight: 35                          # Weight with which this type is selected. (Default: 100)
      multiplier: 20                      # Multiplier for calculating timeouts in matchmaking. Higher values lead to a wider range of opponents.
      max_rating_diff: 200
    rapid:                                # Arbitrary name of the matchmaking type. Names must be unique.
      tc: 8+0                             # Time control in initial_minutes+increment_seconds format.
      rated: true                         # Whether matchmaking should play rated games.
      variant: standard                   # Chess variant (https://lichess.org/variant) to challenge.
      weight: 25                          # Weight with which this type is selected. (Default: 100)
      multiplier: 20                      # Multiplier for calculating timeouts in matchmaking. Higher values lead to a wider range of opponents.
      max_rating_diff: 250

messages:
  # Optional substitution keywords (include curly braces):
  #   {opponent} to insert the opponent's name
  #   {me} to insert our name
  #   {engine} to insert engine name
  #   {cpu} to insert CPU information
  #   {ram} to insert RAM size
  # Any other words in curly braces will be removed.
  greeting: "Hey, I'm running {engine}. Good luck! Type !help for a list of commands." # Message sent to the opponent at the beginning of a game.
  goodbye: "Good game, see you next time."                                             # Message sent to the opponent after the end of a game.
  greeting_spectators: "Hey, I'm running {engine}. Type !help for a list of commands." # Message sent to the spectators at the beginning of a game.
  goodbye_spectators: "Thanks for watching."                                           # Message sent to the spectators after the end of a game.

# whitelist:                              # List of users whose challenges are always accepted.
#   - Username1
#   - Username2

# blacklist:                              # List of users who are not challenged and whose challenges are declined.
#   - Username1
#   - Username2

books:                                    # Names of the opening books (to be used above in the opening_books section) and paths to the opening books.
  Eman: "D:\BotLi-main\engines\Eman.bin"
Is not easy- Now the comman of phyton run and send this error. The fil .yml without tokem.

D:\BotLi-main

C:\Program Files\phyton
Thanks in advance
I am not an expert in anything, I do not believe in anything, but everything is possible.
IbaiBuR

Top contribute Forum
Administrators
Points: 7 707,00 
Forum Contributions
Posts: 149
Joined: 05/01/2021, 15:29
Status: Offline (Active 14 Hours, 19 Minutes ago)
Medals: 1
Topics: 6
Reputation: 252
Location: Madrid, ES
Has thanked: 64 times
Been thanked: 319 times

How to create a Lichess BOT

Post by IbaiBuR »

Igbo I sent you the corrected file by PM 1 or days ago, please check with the corrected file and tell me if there are any errors again.
EmptikBest

Book Maker
Forum Contributions
Points: 16 218,00 
Posts: 401
Joined: 05/07/2023, 13:58
Status: Offline (Active 3 Days, 7 Hours, 50 Minutes ago)
Medals: 1
Topics: 12
Reputation: 209
Has thanked: 29 times
Been thanked: 479 times

How to create a Lichess BOT

Post by EmptikBest »

Igbo wrote: 16/09/2023, 17:28

Code: Select all

D:\BotLi-main>python user_interface.py -m
There appears to be a syntax problem with your config.yml
Traceback (most recent call last):
  File "D:\BotLi-main\user_interface.py", line 315, in <module>
    ui = UserInterface(args.config, args.matchmaking, args.upgrade)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\BotLi-main\user_interface.py", line 43, in __init__
    self.config = load_config(config_path)
                  ^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\BotLi-main\config.py", line 15, in load_config
    raise e
  File "D:\BotLi-main\config.py", line 12, in load_config
    config = yaml.safe_load(yml_input)
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Lib\site-packages\yaml\__init__.py", line 125, in safe_load
    return load(stream, SafeLoader)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Lib\site-packages\yaml\__init__.py", line 81, in load
    return loader.get_single_data()
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Lib\site-packages\yaml\constructor.py", line 49, in get_single_data
    node = self.get_single_node()
           ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Lib\site-packages\yaml\composer.py", line 36, in get_single_node
    document = self.compose_document()
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Lib\site-packages\yaml\composer.py", line 55, in compose_document
    node = self.compose_node(None, None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Lib\site-packages\yaml\composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Lib\site-packages\yaml\composer.py", line 133, in compose_mapping_node
    item_value = self.compose_node(node, item_key)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Lib\site-packages\yaml\composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Lib\site-packages\yaml\composer.py", line 133, in compose_mapping_node
    item_value = self.compose_node(node, item_key)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Lib\site-packages\yaml\composer.py", line 82, in compose_node
    node = self.compose_sequence_node(anchor)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Lib\site-packages\yaml\composer.py", line 110, in compose_sequence_node
    while not self.check_event(SequenceEndEvent):
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Lib\site-packages\yaml\parser.py", line 98, in check_event
    self.current_event = self.state()
                         ^^^^^^^^^^^^
  File "C:\Program Files\Lib\site-packages\yaml\parser.py", line 379, in parse_block_sequence_first_entry
    return self.parse_block_sequence_entry()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Lib\site-packages\yaml\parser.py", line 384, in parse_block_sequence_entry
    if not self.check_token(BlockEntryToken, BlockEndToken):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Lib\site-packages\yaml\scanner.py", line 116, in check_token
    self.fetch_more_tokens()
  File "C:\Program Files\Lib\site-packages\yaml\scanner.py", line 251, in fetch_more_tokens
    return self.fetch_double()
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Lib\site-packages\yaml\scanner.py", line 655, in fetch_double
    self.fetch_flow_scalar(style='"')
  File "C:\Program Files\Lib\site-packages\yaml\scanner.py", line 666, in fetch_flow_scalar
    self.tokens.append(self.scan_flow_scalar(style))
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Lib\site-packages\yaml\scanner.py", line 1149, in scan_flow_scalar
    chunks.extend(self.scan_flow_scalar_non_spaces(double, start_mark))
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Lib\site-packages\yaml\scanner.py", line 1223, in scan_flow_scalar_non_spaces
    raise ScannerError("while scanning a double-quoted scalar", start_mark,
yaml.scanner.ScannerError: while scanning a double-quoted scalar
  in "config.yml", line 31, column 7
found unknown escape character '3'
  in "config.yml", line 31, column 11


D:\BotLi-main>

Code: Select all

token: "xxxxxxxxxx"         # Lichess OAuth2 Token.

engines:
  standard:                               # Engine used for standard chess and when no suitable special engine is configured.
    dir: "./engines"                      # Directory containing the engine.
    name: "EMAN 9.41 64-bit SSE41 POPCNT.exe"                     # Binary name of the engine to use.
    ponder: true                          # Think on opponent's time.
    use_syzygy: true                      # Whether the engine should be configured to use syzygy.
    silence_stderr: false                 # Suppresses stderr output.
    uci_options:                          # Arbitrary UCI options passed to the engine. (Commenting allowed)
      Threads: 36                         # Max CPU threads the engine can use.
      Hash: 4096                         # Max memory (in megabytes) the engine can allocate.
      Move Overhead: 600                 # Increase if your bot flags games too often.
# variants:                               # Engine used for variants when no suitable special engine is configured.
#   dir: "./engines"                      # Directory containing the engine.
#   name: "fairy-EMAN 9.41 64-bit SSE41 POPCNT.exe"               # Binary name of the engine to use.
#   ponder: true                          # Think on opponent's time.
#   use_syzygy: false                     # Whether the engine should be configured to use syzygy.
#   silence_stderr: false                 # Suppresses stderr output.
#   uci_options:                          # Arbitrary UCI options passed to the engine. (Commenting allowed)
#     Threads: 36                          # Max CPU threads the engine can use.
#     Hash: 4096                         # Max memory (in megabytes) the engine can allocate.
#     Move Overhead: 600                  # Increase if your bot flags games too often.
# Use the same pattern for 'bullet', 'blitz', 'rapid', 'classical',
# 'antichess', 'atomic', 'chess960', 'crazyhouse', 'horde', 'kingofthehill', 'racingkings' and '3check' as well.
# Append '_white' or '_black' to use the engine only as the specific color.

syzygy:
  enabled: false                          # Activate local syzygy endgame tablebases.
  paths:                                  # Paths to local syzygy endgame tablebases.
    - "C:\3-4-5"
  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.

opening_books:
  enabled: false                          # Activate opening books.
  priority: 400                           # Priority with which this move source is used. Higher priority is used first.
  books:
#   bullet:
#     selection: weighted_random          # Move selection is one of "weighted_random", "uniform_random" or "best_move".
#     names:                              # List of names of books to use in bullet.
#       - Eman
#       - Eman
#   standard_black:
#     selection: best_move                # Move selection is one of "weighted_random", "uniform_random" or "best_move".
#     names:                              # List of names of books to use as black.
#       - Eman
    standard:
      selection: weighted_random          # Move selection is one of "weighted_random", "uniform_random" or "best_move".
#     max_depth: 50                       # Half move max depth. (Comment this line for max depth)
      names:                              # List of names of books to use if there is no specific book for the time control, white, black or chess960.
        - Eman
#   Use the same pattern for 'bullet', 'blitz', 'rapid', 'classical',
#   'antichess', 'atomic', 'chess960', 'crazyhouse', 'horde', 'kingofthehill', 'racingkings' and '3check' as well.
#   Append '_white' or '_black' to use the books only as the specific color.

online_moves:
  opening_explorer:
    enabled: false                        # Activate online moves from Lichess opening explorer. The move that has performed best for this bot is played.
    priority: 300                         # Priority with which this move source is used. Higher priority is used first.
    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".
    anti: false                           # Whether to play the moves in which the opponent performs the worst.
#   max_depth: 16                         # Half move max depth. (Comment this line for max depth)
#   max_moves: 1                          # Max number of moves played from Lichess opening explorer. (Comment this line for max moves)
  lichess_cloud:
    enabled: false                        # Activate online moves from Lichess cloud eval.
    priority: 200                         # Priority with which this move source is used. Higher priority is used first.
    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)
#   max_moves: 1                          # Max number of moves played from Lichess cloud eval. (Comment this line for max moves)
  chessdb:
    enabled: false                        # Activate online moves from https://chessdb.cn/queryc_en/
    priority: 100                         # Priority with which this move source is used. Higher priority is used first.
    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)
#   max_moves: 1                          # Max number of moves played from chessdb. (Comment this line for max moves)
  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: 0                    # Minimum amount of increment to accept a challenge.
# max_increment: 5                      # Maximum amount of increment to accept a challenge.
# min_initial: 60                         # Minimum amount of initial time to accept a challenge.
# max_initial: 1800                 # 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:                          # Speeds or time controls in initial_minutes+increment_seconds format to accept.
    - bullet
    - blitz
    - rapid
#   - classical
#   - 25+0
  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

bullet:                               # Arbitrary name of the matchmaking type. Names must be unique.
      tc: 1+1                             # Time control in initial_minutes+increment_seconds format.
      rated: true                         # Whether matchmaking should play rated games.
      variant: standard                   # Chess variant (https://lichess.org/variant) to challenge.
      weight: 40                          # Weight with which this type is selected. (Default: 100)
      multiplier: 20                      # Multiplier for calculating timeouts in matchmaking. Higher values lead to a wider range of opponents.
      max_rating_diff: 200
    blitz:                                # Arbitrary name of the matchmaking type. Names must be unique.
      tc: 3+0                             # Time control in initial_minutes+increment_seconds format.
      rated: true                         # Whether matchmaking should play rated games.
      variant: standard                   # Chess variant (https://lichess.org/variant) to challenge.
      weight: 35                          # Weight with which this type is selected. (Default: 100)
      multiplier: 20                      # Multiplier for calculating timeouts in matchmaking. Higher values lead to a wider range of opponents.
      max_rating_diff: 200
    rapid:                                # Arbitrary name of the matchmaking type. Names must be unique.
      tc: 8+0                             # Time control in initial_minutes+increment_seconds format.
      rated: true                         # Whether matchmaking should play rated games.
      variant: standard                   # Chess variant (https://lichess.org/variant) to challenge.
      weight: 25                          # Weight with which this type is selected. (Default: 100)
      multiplier: 20                      # Multiplier for calculating timeouts in matchmaking. Higher values lead to a wider range of opponents.
      max_rating_diff: 250

messages:
  # Optional substitution keywords (include curly braces):
  #   {opponent} to insert the opponent's name
  #   {me} to insert our name
  #   {engine} to insert engine name
  #   {cpu} to insert CPU information
  #   {ram} to insert RAM size
  # Any other words in curly braces will be removed.
  greeting: "Hey, I'm running {engine}. Good luck! Type !help for a list of commands." # Message sent to the opponent at the beginning of a game.
  goodbye: "Good game, see you next time."                                             # Message sent to the opponent after the end of a game.
  greeting_spectators: "Hey, I'm running {engine}. Type !help for a list of commands." # Message sent to the spectators at the beginning of a game.
  goodbye_spectators: "Thanks for watching."                                           # Message sent to the spectators after the end of a game.

# whitelist:                              # List of users whose challenges are always accepted.
#   - Username1
#   - Username2

# blacklist:                              # List of users who are not challenged and whose challenges are declined.
#   - Username1
#   - Username2

books:                                    # Names of the opening books (to be used above in the opening_books section) and paths to the opening books.
  Eman: "D:\BotLi-main\engines\Eman.bin"
Is not easy- Now the comman of phyton run and send this error. The fil .yml without tokem.

D:\BotLi-main

C:\Program Files\phyton
Thanks in advance
Oh sorry, I forgot to change the backslash to a forward slash...
Change C:\3-4-5 to C:/3-4-5 and you will be fine I think..
Igbo

Top contribute Forum Book Maker
Global moderators
Points: 78 856,00 
Forum Contributions
Posts: 670
Joined: 21/03/2022, 20:57
Status: Offline (Active 5 Hours, 49 Minutes ago)
Medals: 2
Topics: 41
Reputation: 2961
Location: terrassa, Spain
Has thanked: 700 times
Been thanked: 4044 times

How to create a Lichess BOT

Post by Igbo »

Ibai has achieved it, we already have both playing in lichess :-) Congratulations!
I am not an expert in anything, I do not believe in anything, but everything is possible.
M.Z

Top contribute Forum Engines Maker
Founder
Points: 31 381,00 
Forum Contributions
Posts: 1457
Joined: 31/10/2019, 8:50
Status: Offline (Active 3 Hours, 3 Minutes ago)
Medals: 2
Topics: 217
Reputation: 4118
Has thanked: 655 times
Been thanked: 3112 times

How to create a Lichess BOT

Post by M.Z »

Igbo wrote: 18/09/2023, 12:17 Ibai has achieved it, we already have both playing in lichess :-) Congratulations!
Hi Jorge,
what is the name of your bot?
I would like to give him some nice defeats.. xrf24
Igbo

Top contribute Forum Book Maker
Global moderators
Points: 78 856,00 
Forum Contributions
Posts: 670
Joined: 21/03/2022, 20:57
Status: Offline (Active 5 Hours, 49 Minutes ago)
Medals: 2
Topics: 41
Reputation: 2961
Location: terrassa, Spain
Has thanked: 700 times
Been thanked: 4044 times

How to create a Lichess BOT

Post by Igbo »

M.Z wrote: 18/09/2023, 13:27
Igbo wrote: 18/09/2023, 12:17 Ibai has achieved it, we already have both playing in lichess :-) Congratulations!
Hi Jorge,
what is the name of your bot?
I would like to give him some nice defeats.. xrf24
Africaata
I am not an expert in anything, I do not believe in anything, but everything is possible.
Post Reply

Return to “Programming, Technical Discussions, Chess related questions etc.”