Spaces:
Sleeping
Sleeping
gbtami commited on
Commit ·
d88f2ed
1
Parent(s): e165407
Add book sub section to polyglot config
Browse files- config.yml.default +9 -8
- lichess-bot.py +3 -2
config.yml.default
CHANGED
|
@@ -7,14 +7,15 @@ engine: # engine settings
|
|
| 7 |
protocol: "uci" # "uci" or "xboard"
|
| 8 |
polyglot:
|
| 9 |
enabled: false # activate polyglot book
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
#
|
| 13 |
-
#
|
| 14 |
-
#
|
| 15 |
-
#
|
| 16 |
-
#
|
| 17 |
-
#
|
|
|
|
| 18 |
max_depth: 8 # half move max depth
|
| 19 |
min_weight: 1 # selects move with highest weight but not below this value
|
| 20 |
selection: "weighted_random" # move slection is one of "weighted_random", "uniform_random" or "best_move" (but not below the min_weight in 2. and 3. case)
|
|
|
|
| 7 |
protocol: "uci" # "uci" or "xboard"
|
| 8 |
polyglot:
|
| 9 |
enabled: false # activate polyglot book
|
| 10 |
+
book:
|
| 11 |
+
standard: "engines/book.bin" # book file path of standard chess
|
| 12 |
+
# atomic: "atomic book path"
|
| 13 |
+
# giveaway: "antichess book path"
|
| 14 |
+
# crazyhouse: "crazyhouse book path"
|
| 15 |
+
# horde: "horde book path"
|
| 16 |
+
# kingofthehill: "kingOfTheHill book path"
|
| 17 |
+
# racingkings: "racingKings book path"
|
| 18 |
+
# 3check: "threeCheck book path"
|
| 19 |
max_depth: 8 # half move max depth
|
| 20 |
min_weight: 1 # selects move with highest weight but not below this value
|
| 21 |
selection: "weighted_random" # move slection is one of "weighted_random", "uniform_random" or "best_move" (but not below the min_weight in 2. and 3. case)
|
lichess-bot.py
CHANGED
|
@@ -120,8 +120,9 @@ def play_game(li, game_id, control_queue, engine_factory, user_profile, config):
|
|
| 120 |
|
| 121 |
engine_cfg = config["engine"]
|
| 122 |
polyglot_cfg = engine_cfg.get("polyglot", {})
|
|
|
|
| 123 |
|
| 124 |
-
if not polyglot_cfg.get("enabled") or not play_first_book_move(game, engine, board, li,
|
| 125 |
play_first_move(game, engine, board, li)
|
| 126 |
|
| 127 |
engine.set_time_control(game)
|
|
@@ -144,7 +145,7 @@ def play_game(li, game_id, control_queue, engine_factory, user_profile, config):
|
|
| 144 |
time.sleep(sleep)
|
| 145 |
best_move = None
|
| 146 |
if polyglot_cfg.get("enabled") and len(moves) <= polyglot_cfg.get("max_depth", 8) * 2 - 1:
|
| 147 |
-
best_move = get_book_move(board,
|
| 148 |
if best_move == None:
|
| 149 |
best_move = engine.search(board, upd["wtime"], upd["btime"], upd["winc"], upd["binc"])
|
| 150 |
li.make_move(game.id, best_move)
|
|
|
|
| 120 |
|
| 121 |
engine_cfg = config["engine"]
|
| 122 |
polyglot_cfg = engine_cfg.get("polyglot", {})
|
| 123 |
+
book_cfg = polyglot_cfg.get("book", {})
|
| 124 |
|
| 125 |
+
if not polyglot_cfg.get("enabled") or not play_first_book_move(game, engine, board, li, book_cfg):
|
| 126 |
play_first_move(game, engine, board, li)
|
| 127 |
|
| 128 |
engine.set_time_control(game)
|
|
|
|
| 145 |
time.sleep(sleep)
|
| 146 |
best_move = None
|
| 147 |
if polyglot_cfg.get("enabled") and len(moves) <= polyglot_cfg.get("max_depth", 8) * 2 - 1:
|
| 148 |
+
best_move = get_book_move(board, book_cfg)
|
| 149 |
if best_move == None:
|
| 150 |
best_move = engine.search(board, upd["wtime"], upd["btime"], upd["winc"], upd["binc"])
|
| 151 |
li.make_move(game.id, best_move)
|