This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Elo: | |
| def __init__(self, rating: float = 1000.0): | |
| self.rating = rating | |
| def _expected(self, other: Elo) -> float: | |
| """ | |
| Calculates the expected outcome when playing against an other player. | |
| """ | |
| magic_number = 1.0 / 400.0 | |
| q1 = 10**(self.rating * magic_number) |