Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
AttackingOrDefending authored Sep 26, 2024
1 parent c981b8c commit 9bdd240
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
8 changes: 3 additions & 5 deletions config.yml.default
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 3 additions & 4 deletions lib/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion lib/engine_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down

0 comments on commit 9bdd240

Please sign in to comment.