-
Notifications
You must be signed in to change notification settings - Fork 455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the option to prefer high/low rated players #865
Add the option to prefer high/low rated players #865
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The feature seems useful to me, but I was wondering about some of the calculations.
Also, config options like this one (that have a few special values and everything else falls back to a default behavior) are always error-prone. I feel like it won't take long until someone has a typo in their config, e.g. "hihg", which just gets ignored silently.
Some similar fields have a check for this in config.py
, see e.g. valid_pgn_grouping_options
. So maybe it would be a good idea to do something similar for the rating preference.
I could also imagine this kind of check being done similarly to (or even as part of) set_config_default
. Just as the default
value, we could optionally list the valid values of each field, in a uniform declarative way. But that change might be better as a separate refactoring.
"""Get the weight for each bot. A higher weights means the bot is more likely to get challenged.""" | ||
weights = [1] * len(online_bots) | ||
if rating_preference == "high": | ||
reduce_ratings_by = min(min_rating - (max_rating - min_rating), min_rating - 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does this calculation come from? Isn't min_rating - (max_rating - min_rating)
just max_rating
? Then min
only really makes sense here in the case where min_rating > max_rating
, which seems like it should never happen.
Maybe I'm missing something, but then a clarifying comment would be helpful for future readers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This calculation is the same as 2*min_rating-max_rating
. With this change, a bot with max_rating
rating will be twice as likely to get picked as a bot with min_rating
. I will add a comment.
I will add checks for valid option values. |
The bot can now prefer high rated players, low rated players, or have no preference at all.
EDIT: Will fix the tests later.
closes #840