Skip to content

Commit

Permalink
Support of another ELO restriction UCI parameter for the PicoChess au…
Browse files Browse the repository at this point in the history
…to elo feature

Support of "UCI_Limit" for auto elo feature
  • Loading branch information
tosca07 authored Jul 30, 2024
1 parent 4a837b0 commit 21f2a22
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions uci/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

UCI_ELO = "UCI_Elo"
UCI_ELO_NON_STANDARD = "UCI Elo"
UCI_ELO_NON_STANDARD2 = "UCI_Limit"

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -374,6 +375,8 @@ def _engine_rating(self, rating: Optional[Rating] = None):
uci_elo_option_string = UCI_ELO
elif UCI_ELO_NON_STANDARD in self.options:
uci_elo_option_string = UCI_ELO_NON_STANDARD
elif UCI_ELO_NON_STANDARD2 in self.options:
uci_elo_option_string = UCI_ELO_NON_STANDARD2
if uci_elo_option_string is not None:
uci_elo_option = self.options[uci_elo_option_string].strip()
if uci_elo_option.lower() == "auto" and rating is not None:
Expand Down Expand Up @@ -424,6 +427,8 @@ def _set_uci_elo_to_engine_rating(self):
self.options[UCI_ELO] = str(int(self.engine_rating))
elif UCI_ELO_NON_STANDARD in self.options:
self.options[UCI_ELO_NON_STANDARD] = str(int(self.engine_rating))
elif UCI_ELO_NON_STANDARD2 in self.options:
self.options[UCI_ELO_NON_STANDARD2] = str(int(self.engine_rating))

def _save_rating(self, new_rating: Rating):
write_picochess_ini("pgn-elo", max(500, int(new_rating.rating)))
Expand Down

0 comments on commit 21f2a22

Please sign in to comment.