Skip to content

Commit

Permalink
Add a buffer to the rating-based opening explorer
Browse files Browse the repository at this point in the history
  • Loading branch information
qpwoeirut committed Jul 19, 2024
1 parent 8b12a97 commit 49d8269
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions homemade.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ def get_opening_explorer_move_list(self, board: chess.Board) -> tuple[list[dict[
response = self.li.online_book_get("https://explorer.lichess.ovh/player", params, stream=True)
if response["moves"]:
return response["moves"], OpeningsBotModeEnum.PLAYER_OPENINGS
else: # if there's no moves found, try the general opening explorer next at the player's rating or higher
else: # if there's no moves found, try the general opening explorer near the player's rating or higher
# Passing in a list causes duplicate arguments instead of a comma-separated list
ratings = ','.join([str(rating) for rating in RATINGS if rating >= self.opening_book_player_rating])
ratings = ','.join([str(rating) for rating in RATINGS if rating + 200 >= self.opening_book_player_rating])
params = {"fen": board.fen(), "moves": 100, "variant": variant, "topGames": 0, "recentGames": 0,
"ratings": ratings}
response = self.li.online_book_get("https://explorer.lichess.ovh/lichess", params)
Expand Down

0 comments on commit 49d8269

Please sign in to comment.