lichess-bot-devs / lichess-bot

A bridge between Lichess bots and chess engines
GNU Affero General Public License v3.0
778 stars 450 forks source link

Zappa Mexico II no longer works #388

Closed inversed-ru closed 3 years ago

inversed-ru commented 3 years ago

I used to run a Zappa Mexico II bot on Lichess, but sadly it no longer works. After starting a game I get the following error in the console: Backing off create_engine(...) for 0.1s (chess.engine.EngineError: unknown option type: '') Changing the uci_options in the config or even removing the entire section has no effect. Stockfish seems to work without issues.

MarkZH commented 3 years ago

Can you post your config file (make sure to remove the token)? Either use https://gist.github.com/ and put a link here or put it into a reply here using a code block to preserve spacing.

inversed-ru commented 3 years ago

@MarkZH Sure:

token: "................"
url: "https://lichess.org/"

engine:
  dir: "./engines/"
  name: "Zappa_Mexico_II_x64.exe"
  protocol: "uci"
  polyglot:
    enabled: false
    book:
      standard:
        - engines/Book.bin
    max_depth: 8
    min_weight: 1
    selection: "uniform_random"
  uci_options:
    Move Overhead: 100
    Threads: 4
    Hash: 1024
  silence_stderr: false

abort_time: 40
fake_think_time: false

challenge:
  concurrency: 1
  sort_by: "best"
  accept_bot: true
  max_increment: 60
  min_increment: 0
  max_base: 1200
  min_base: 0
  variants:
    - standard
  time_controls:
    - ultraBullet
    - bullet
    - blitz
    - rapid
  modes:
    - casual
    - rated
MarkZH commented 3 years ago

Thanks. Nothing immediately jumps out. Can you run lichess-bot with the -v (verbose) option and copy everything up to the error here?

Also, what changed when the bot stopped working? Upgrading lichess-bot? Updating requirements?

inversed-ru commented 3 years ago

@MarkZH Installed a fresh version of lichess-bot on a new PC. The one I've been using before dates back to 2019. Here is the verbose log up to the first error:

2021-08-27 22:41:18,873: Starting new HTTPS connection (1): lichess.org:443
2021-08-27 22:41:19,180: https://lichess.org:443 "GET /api/account HTTP/1.1" 200 None
2021-08-27 22:41:19,181: Welcome DissidentAggressor!
2021-08-27 22:41:19,181: You're now connected to https://lichess.org/ and awaiting challenges.
2021-08-27 22:41:42,863: Accept Rapid casual challenge from inversed(1981)
2021-08-27 22:41:42,865: Resetting dropped connection: lichess.org
2021-08-27 22:41:43,073: https://lichess.org:443 "POST /api/challenge/FnJyF7FG/accept HTTP/1.1" 200 11
2021-08-27 22:41:43,074: --- Process Queue. Total Queued: 1. Total Used: 0
2021-08-27 22:41:43,091: --- Process Used. Total Queued: 0. Total Used: 1
2021-08-27 22:41:43,099: Starting new HTTPS connection (1): lichess.org:443
2021-08-27 22:41:43,295: https://lichess.org:443 "GET /api/bot/game/stream/FnJyF7FG HTTP/1.1" 200 None
2021-08-27 22:41:43,296: Using proactor: IocpProactor
2021-08-27 22:41:43,341: <UciProtocol (pid=7704)>: Connection made
2021-08-27 22:41:43,342: <UciProtocol (pid=7704)>: << uci
2021-08-27 22:41:43,585: <UciProtocol (pid=7704)>: >> id name Zappa Mexico II
2021-08-27 22:41:43,585: <UciProtocol (pid=7704)>: >> id author Anthony Cozzie
2021-08-27 22:41:43,585: <UciProtocol (pid=7704)>: >> option name MultiPV type spin default 1 min 1 max 127
2021-08-27 22:41:43,585: <UciProtocol (pid=7704)>: >> option name NalimovPath type string default C:\
2021-08-27 22:41:43,585: <UciProtocol (pid=7704)>: >> option name NalimovCache type spin default 8 min 0 max 128
2021-08-27 22:41:43,586: <UciProtocol (pid=7704)>: >> option name UCI_ShowCurrLine type check default false
2021-08-27 22:41:43,586: <UciProtocol (pid=7704)>: >> option name Hash type spin default 128 min 4 max 1048576
2021-08-27 22:41:43,586: <UciProtocol (pid=7704)>: >> option name Clear Hash Tables type button
2021-08-27 22:41:43,586: <UciProtocol (pid=7704)>: >> option name Threads type string default auto
2021-08-27 22:41:43,586: <UciProtocol (pid=7704)>: >> option name Enable Null Move type check default true
2021-08-27 22:41:43,586: <UciProtocol (pid=7704)>: >> option name Enable History Pruning type check default true
2021-08-27 22:41:43,586: <UciProtocol (pid=7704)>: >> option name Enable Singular Extensions type check default true
2021-08-27 22:41:43,587: <UciProtocol (pid=7704)>: >> option name Enable Mate Extensions type check default false
2021-08-27 22:41:43,587: <UciProtocol (pid=7704)>: >> option name Enable Futility Pruning type check default true
2021-08-27 22:41:43,587: <UciProtocol (pid=7704)>: >> option name Aggressive Futility Pruning type check default false
2021-08-27 22:41:43,587: <UciProtocol (pid=7704)>: >> option name TB Min Depth type spin default 4 min 1 max 128
2021-08-27 22:41:43,587: <UciProtocol (pid=7704)>: >> option name Null Move R4 Min Depth type spin default 100 min 0 max 100
2021-08-27 22:41:43,587: <UciProtocol (pid=7704)>: >> option name Singular Margin type spin default 75 min 10 max 100
2021-08-27 22:41:43,587: <UciProtocol (pid=7704)>: >> option name Singular Margin PV type spin default 50 min 10 max 100
2021-08-27 22:41:43,588: <UciProtocol (pid=7704)>: >> option name Singular Extension Min Depth default 4 min 4 max 100
2021-08-27 22:41:43,588: <UciProtocol (pid=7704)>: >> option name Eval Passed Pawn Scoring type spin default 100 min 0 max 500
2021-08-27 22:41:43,588: <UciProtocol (pid=7704)>: >> option name Eval Pawn Scoring type spin default 100 min 0 max 500
2021-08-27 22:41:43,588: <UciProtocol (pid=7704)>: >> option name Eval Minor Scoring type spin default 100 min 0 max 500
2021-08-27 22:41:43,588: <UciProtocol (pid=7704)>: >> option name Eval Major Scoring type spin default 100 min 0 max 500
2021-08-27 22:41:43,588: <UciProtocol (pid=7704)>: >> option name Eval Kingsafety Scoring type spin default 100 min 0 max 500
2021-08-27 22:41:43,588: <UciProtocol (pid=7704)>: >> option name Internet Lag type spin default 0 min 0 max 30000
2021-08-27 22:41:43,589: <UciProtocol (pid=7704)>: >> option name Contempt type spin default 0 min -200 max 200
2021-08-27 22:41:43,589: <UciProtocol (pid=7704)>: >> option name Hide Fail Highs type check default true
2021-08-27 22:41:43,589: <UciProtocol (pid=7704)>: >> option name Print PV Tips type check default false
2021-08-27 22:41:43,589: <UciProtocol (pid=7704)>: >> uciok
2021-08-27 22:41:43,590: Backing off create_engine(...) for 0.5s (chess.engine.EngineError: unknown option type: '')

Backing off create_engine line then repeats with increasing delays.

MarkZH commented 3 years ago

2021-08-27 22:41:43,588: <UciProtocol (pid=7704)>: >> option name Singular Extension Min Depth default 4 min 4 max 100

This option is missing a type field. Somewhere in this line there should be a type spin. This is a bug in the engine.

MarkZH commented 3 years ago

Unless you can get the source code to the Zappa engine, here's something you can try. In the lichess-bot directory, open .venv\Lib\site-packages\chess\engine.py (the .venv directory may be different depending on what you typed when running virtualenv when you set up lichess-bot). Just above the line 1390, add type = type or ["spin"]. That part of the code should then look like

            type = type or ["spin"]
            without_default = Option(" ".join(name), " ".join(type), None, min, max, var)
            option = Option(without_default.name, without_default.type, without_default.parse(" ".join(default)), min, max, var)
            engine.options[option.name] = option

Let me know if this gets your bot working.

MarkZH commented 3 years ago

The main problem with the above fix is that it will have to be repeated every time python-chess gets upgraded when a new version of lichess-bot is released.

inversed-ru commented 3 years ago

@MarkZH Thanks a lot, the fix helped!