vivekjoshy / openskill.py

Multiplayer Rating System. No Friction.

Home Page:https://openskill.me

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue: mu and sigma can't be set to zero

martinazapletalova opened this issue · comments

Describe the bug
Player rating parameters mu and sigma cant be set to 0.0, they are overwritten by default values 25 and 8.333.
The issue is file openskill/rate.py on rows 28, 29:

self.mu = mu if mu else default_mu(**options)
self.sigma = sigma if sigma else default_sigma(**options)

Conditions mu if mu and sigma if sigma return False when mu or sigma is set to 0.
Also, one cosmetic thing, you have the wrong typing in openskill/constants.py for functions z and mu. When the default z or mu value is used you are returning 3 or 25 (int) instead of float.

To Reproduce

from openskill import Rating

Rating(mu=0.0, sigma=5)
Rating(mu=25, sigma=0.0)
Rating(mu=0.0, sigma=0.0)

Expected behavior
It should be possible to set them to a value of 0.0.

Screenshots
image

Possible solution

if isinstance(mu, float) or isinstance(mu, int):
    self.mu = mu
else:
    self.mu = default_mu(**options)

Platform Information

  • OS: [macOS]
  • Python Version: [3.8.13]
  • openskill.py Version: [2.5.0]

Additional context

@martinazapletalova Nice catch! This will be fixed in the next patch update.