Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
wind23 committed Jan 31, 2022
1 parent 7614a5d commit 0b98035
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.pyc
__pycache__
dist
*.egg-info/
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,31 @@ The implementation is based on the [Ruby code](https://github.com/goshrine/whole
## Installation

pip install whr

# Usage

In [1]: import whr
...:
...: base = whr.Base(config={'w2': 30})
...: base.create_game('Alice', 'Carol', 'D', 0) # Alice and Carol had a draw on Day 0
...: base.create_game('Bob', 'Dave', 'B', 10) # Bob won Dave on Day 10
...: base.create_game('Dave', 'Alice', 'W', 30) # Dave lost to Alice on Day 30
...: base.create_game('Bob', 'Carol', 'W', 60) # Bob lost to Carol on Day 60
...:
...: base.iterate(50) # iterate for 50 rounds

In [2]: print(base.ratings_for_player('Alice'))
...: print(base.ratings_for_player('Bob'))
...: print(base.ratings_for_player('Carol'))
...: print(base.ratings_for_player('Dave'))
[[0, 78.50976252870765, 114.0890917675107], [30, 79.47183295485291, 116.02912272478814]]
[[10, -15.262552175731381, 108.50075126605397], [60, -18.08603087778281, 111.07152016073245]]
[[0, 103.9187774903099, 108.03027219107216], [60, 107.30695193277161, 111.12369929419124]]
[[10, -176.6773935927304, 134.07989121465133], [30, -177.31877387682724, 135.25422816732765]]

In [3]: print(base.get_ordered_ratings())
[('Carol', [[0, 103.9187774903099, 108.03027219107216], [60, 107.30695193277161, 111.12369929419124]]), ('Alice', [[0, 78.50976252870765, 114.0890917675107], [30, 79.47183295485291, 116.02912272478814]]), ('Bob', [[10, -15.262552175731381, 108.50075126605397], [60, -18.08603087778281, 111.07152016073245]]), ('Dave', [[10, -176.6773935927304, 134.07989121465133], [30, -177.31877387682724, 135.25422816732765]])]

# References

Rémi Coulom. Whole-history rating: A Bayesian rating system for players of time-varying strength. In _International Conference on Computers and Games_. 2008. <https://www.remi-coulom.fr/WHR/WHR.pdf>
12 changes: 2 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
setup(
name='whr',
packages=['whr'],
version='1.0.0',
version='1.0.1',
license='MIT',
description=
'A Python implementation of the Whole History Rating algorithm proposed by Rémi Coulom. '
Expand All @@ -19,21 +19,13 @@
author_email='haotianyi0@126.com',
url='https://github.com/wind23/whole_history_rating',
download_url=
'https://github.com/wind23/whole_history_rating/archive/1.0.0.tar.gz',
'https://github.com/wind23/whole_history_rating/archive/1.0.1.tar.gz',
keywords=['WHR', 'whole history rating', 'Elo rating'],
install_requires=[],
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Topic :: Software Development :: Build Tools',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
],
)

0 comments on commit 0b98035

Please sign in to comment.