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 Nov 7, 2023
1 parent 86fa633 commit 3b9d5b3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions matchmaking.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,12 @@ def get_weights(self, online_bots: list[USER_PROFILE_TYPE], rating_preference: s
game_type: str) -> list[int]:
"""Get the weight for each bot. A higher weights means the bot is more likely to get challenged."""
if rating_preference == "high":
# A bot with max_rating rating will be twice as likely to get picked than a bt with min_rating rating.
# A bot with max_rating rating will be twice as likely to get picked than a bot with min_rating rating.
reduce_ratings_by = min(min_rating - (max_rating - min_rating), min_rating - 1)
# or, reduce_ratings_by = min(2 * min_rating - max_rating, min_rating - 1)
weights = [bot.get("perfs", {}).get(game_type, {}).get("rating", 0) - reduce_ratings_by for bot in online_bots]
elif rating_preference == "low":
# A bot with min_rating rating will be twice as likely to get picked than a bt with max_rating rating.
# A bot with min_rating rating will be twice as likely to get picked than a bot with max_rating rating.
reduce_ratings_by = max(max_rating - (min_rating - max_rating), max_rating + 1)
# or, reduce_ratings_by = max(2 * max_rating - min_rating, max_rating + 1)
weights = [(reduce_ratings_by - bot.get("perfs", {}).get(game_type, {}).get("rating", 0))
Expand Down

0 comments on commit 3b9d5b3

Please sign in to comment.