diff --git a/config.yml.default b/config.yml.default index 879312913..51c87af19 100644 --- a/config.yml.default +++ b/config.yml.default @@ -4,11 +4,9 @@ url: "https://lichess.org/" # Lichess base URL. engine: # Engine settings. dir: "./engines/" # Directory containing the engine. This can be an absolute path or one relative to lichess-bot/. name: "engine_name" # Binary name of the engine to use. - before_name_parameters: - # - "java" - # - "-jar" - after_name_parameters: - # - "-threads=2" +# interpreter: "java" + interpreter_options: + # - "-jar" working_dir: "" # Directory where the chess engine will read and write files. If blank or missing, the current directory is used. # NOTE: If working_dir is set, the engine will look for files and directories relative to this directory, not where lichess-bot was launched. Absolute paths are unaffected. protocol: "uci" # "uci", "xboard" or "homemade" diff --git a/lib/config.py b/lib/config.py index 730973ab3..2c3fcd020 100644 --- a/lib/config.py +++ b/lib/config.py @@ -148,10 +148,9 @@ def insert_default_values(CONFIG: CONFIG_DICT_TYPE) -> None: set_config_default(CONFIG, key="pgn_directory", default=None) set_config_default(CONFIG, key="pgn_file_grouping", default="game", force_empty_values=True) set_config_default(CONFIG, key="max_takebacks_accepted", default=0, force_empty_values=True) - set_config_default(CONFIG, "engine", key="before_name_parameters", default=[], force_empty_values=True) - change_value_to_list(CONFIG, "engine", key="before_name_parameters") - set_config_default(CONFIG, "engine", key="after_name_parameters", default=[], force_empty_values=True) - change_value_to_list(CONFIG, "engine", key="after_name_parameters") + set_config_default(CONFIG, "engine", key="interpreter", default=None) + set_config_default(CONFIG, "engine", key="interpreter_options", default=[], force_empty_values=True) + change_value_to_list(CONFIG, "engine", key="interpreter_options") set_config_default(CONFIG, "engine", key="working_dir", default=os.getcwd(), force_empty_values=True) set_config_default(CONFIG, "engine", key="silence_stderr", default=False) set_config_default(CONFIG, "engine", "draw_or_resign", key="offer_draw_enabled", default=False) diff --git a/lib/engine_wrapper.py b/lib/engine_wrapper.py index ab7f984de..450480dbd 100644 --- a/lib/engine_wrapper.py +++ b/lib/engine_wrapper.py @@ -44,7 +44,11 @@ def create_engine(engine_config: Configuration, game: Optional[model.Game] = Non cfg = engine_config.engine engine_path = os.path.abspath(os.path.join(cfg.dir, cfg.name)) engine_type = cfg.protocol - commands = cfg.before_name_parameters + [engine_path] + cfg.after_name_parameters + commands = [] + if cfg.interpreter: + commands.append(cfg.interpreter) + commands.extend(cfg.interpreter_options) + commands.append(engine_path) if cfg.engine_options: for k, v in cfg.engine_options.items(): commands.append(f"--{k}={v}" if v is not None else f"--{k}")