Name | Python-Elo-System JSON |
Version |
2.1.1
JSON |
| download |
home_page | None |
Summary | Yet another Python Implementation of the Elo rating system. |
upload_time | 2023-04-16 15:53:31 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.10 |
license | None |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Python Implementation - Elo Rating System
This is a fork of Python Implementation - Elo Rating System by Kraktoos and adds
the following features:
- Ranks can be turned on or off.
- Win, lose and draw counts.
- Uses hatch instead of setup.py for packaging.
- Rewritten to use a player class instead of a dictionary to store statistics.
- Use a dictionary as a record for players and statistics instead of a list.
- Use argument keywords to set winner, loser and draws.
## Examples
### Creating an Implementation
```python
from elo_system import EloSystem
elo = EloSystem(base_elo = 1000, k = 32) # Base values for base_elo and k and has support for rankings
```
### Adding and Removing Players
```python
elo.add_player("John")
elo.add_player("Marcus", 1400)
print(elo.get_overall_list())
elo.remove_player("Marcus")
print(elo.get_overall_list())
```
```bash
[{'player': 'Marcus', 'elo': 1400, 'rank': 'Silver'}, {'player': 'John', 'elo': 1000, 'rank': 'Iron'}]
[{'player': 'John', 'elo': 1000, 'rank': 'Iron'}]
```
### Recording a Match
```python
elo.add_player("John")
elo.add_player("Marcus", 1400)
print(elo.get_overall_list())
elo.record_match(winner="Marcus", loser="John")
print(elo.get_overall_list())
elo.record_match(loser="Marcus", winner="John")
print(elo.get_overall_list())
elo.record_match(winner="Marcus", loser="John", draw=True) # When draw is passed true, regardless who is the winner, the match is a draw
print(elo.get_overall_list())
```
```bash
[{'player': 'Marcus', 'elo': 1400, 'rank': 'Silver'}, {'player': 'John', 'elo': 1000, 'rank': 'Iron'}]
[{'player': 'Marcus', 'elo': 1402, 'rank': 'Silver'}, {'player': 'John', 'elo': 997, 'rank': 'Iron'}]
[{'player': 'Marcus', 'elo': 1372, 'rank': 'Silver'}, {'player': 'John', 'elo': 1026, 'rank': 'Iron'}]
[{'player': 'Marcus', 'elo': 1359, 'rank': 'Silver'}, {'player': 'John', 'elo': 1038, 'rank': 'Iron'}]
```
### Other Useful Methods
```python
elo.add_player("John")
elo.add_player("Marcus", 2400)
elo.add_player("James", 1000)
# There is also set_elo(), reset_elo(), add_elo(), remove_elo(), and get_wins(), etc...
print(elo.get_overall_list())
print(elo.get_player_elo("John"))
print(elo.get_player_rank("Marcus"))
print(elo.get_player_count())
print(elo.get_players_with_elo(1000))
print(elo.get_players_with_rank("Silver"))
```
```bash
[{'player': 'Marcus', 'elo': 2400, 'rank': 'Grand Master'}, {'player': 'John', 'elo': 1000, 'rank': 'Iron'}, {'player': 'James', 'elo': 1000, 'rank': 'Iron'}]
1000
Grand Master
3
['John', 'James']
[]
```
Raw data
{
"_id": null,
"home_page": null,
"name": "Python-Elo-System",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": null,
"author": null,
"author_email": "Kraktoos <kraktoos@gmail.com>, Samuel Wu <twopizza9621536@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/ef/e1/9d6614e7a8ff81fe6b6b750d16362ddb8ee73e3780e6c5fb90c37830892b/python_elo_system-2.1.1.tar.gz",
"platform": null,
"description": "# Python Implementation - Elo Rating System\n\nThis is a fork of Python Implementation - Elo Rating System by Kraktoos and adds\nthe following features:\n\n- Ranks can be turned on or off.\n- Win, lose and draw counts.\n- Uses hatch instead of setup.py for packaging.\n- Rewritten to use a player class instead of a dictionary to store statistics.\n- Use a dictionary as a record for players and statistics instead of a list.\n- Use argument keywords to set winner, loser and draws.\n\n## Examples\n\n### Creating an Implementation\n\n```python\nfrom elo_system import EloSystem\nelo = EloSystem(base_elo = 1000, k = 32) # Base values for base_elo and k and has support for rankings\n```\n\n### Adding and Removing Players\n\n```python\nelo.add_player(\"John\")\nelo.add_player(\"Marcus\", 1400)\nprint(elo.get_overall_list())\nelo.remove_player(\"Marcus\")\nprint(elo.get_overall_list())\n```\n\n```bash\n[{'player': 'Marcus', 'elo': 1400, 'rank': 'Silver'}, {'player': 'John', 'elo': 1000, 'rank': 'Iron'}]\n[{'player': 'John', 'elo': 1000, 'rank': 'Iron'}]\n```\n\n### Recording a Match\n\n```python\nelo.add_player(\"John\")\nelo.add_player(\"Marcus\", 1400)\nprint(elo.get_overall_list())\nelo.record_match(winner=\"Marcus\", loser=\"John\")\nprint(elo.get_overall_list())\nelo.record_match(loser=\"Marcus\", winner=\"John\")\nprint(elo.get_overall_list())\nelo.record_match(winner=\"Marcus\", loser=\"John\", draw=True) # When draw is passed true, regardless who is the winner, the match is a draw\nprint(elo.get_overall_list())\n```\n\n```bash\n[{'player': 'Marcus', 'elo': 1400, 'rank': 'Silver'}, {'player': 'John', 'elo': 1000, 'rank': 'Iron'}]\n[{'player': 'Marcus', 'elo': 1402, 'rank': 'Silver'}, {'player': 'John', 'elo': 997, 'rank': 'Iron'}]\n[{'player': 'Marcus', 'elo': 1372, 'rank': 'Silver'}, {'player': 'John', 'elo': 1026, 'rank': 'Iron'}]\n[{'player': 'Marcus', 'elo': 1359, 'rank': 'Silver'}, {'player': 'John', 'elo': 1038, 'rank': 'Iron'}]\n```\n\n### Other Useful Methods\n\n```python\nelo.add_player(\"John\")\nelo.add_player(\"Marcus\", 2400)\nelo.add_player(\"James\", 1000)\n# There is also set_elo(), reset_elo(), add_elo(), remove_elo(), and get_wins(), etc...\nprint(elo.get_overall_list())\nprint(elo.get_player_elo(\"John\"))\nprint(elo.get_player_rank(\"Marcus\"))\nprint(elo.get_player_count())\nprint(elo.get_players_with_elo(1000))\nprint(elo.get_players_with_rank(\"Silver\"))\n```\n\n```bash\n[{'player': 'Marcus', 'elo': 2400, 'rank': 'Grand Master'}, {'player': 'John', 'elo': 1000, 'rank': 'Iron'}, {'player': 'James', 'elo': 1000, 'rank': 'Iron'}]\n1000\nGrand Master\n3\n['John', 'James']\n[]\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "Yet another Python Implementation of the Elo rating system.",
"version": "2.1.1",
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "599aa4af8ec387f83e659c8e453c9c5b77e94ebeb114007cf58c6870856dcc50",
"md5": "b95e443fd0b6e42df789803208c4b015",
"sha256": "de183459318be47b266759fa12d41f8b624aa5cb6e87e9f76146c216f5428bef"
},
"downloads": -1,
"filename": "python_elo_system-2.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b95e443fd0b6e42df789803208c4b015",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 4694,
"upload_time": "2023-04-16T15:53:28",
"upload_time_iso_8601": "2023-04-16T15:53:28.626954Z",
"url": "https://files.pythonhosted.org/packages/59/9a/a4af8ec387f83e659c8e453c9c5b77e94ebeb114007cf58c6870856dcc50/python_elo_system-2.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "efe19d6614e7a8ff81fe6b6b750d16362ddb8ee73e3780e6c5fb90c37830892b",
"md5": "35e86cefffd45d8c41ff8b8e95e80b11",
"sha256": "95c80b59fbf3dba4a8712c814a98808a097455866d354d93acb8f50e9de8f323"
},
"downloads": -1,
"filename": "python_elo_system-2.1.1.tar.gz",
"has_sig": false,
"md5_digest": "35e86cefffd45d8c41ff8b8e95e80b11",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 8496,
"upload_time": "2023-04-16T15:53:31",
"upload_time_iso_8601": "2023-04-16T15:53:31.149125Z",
"url": "https://files.pythonhosted.org/packages/ef/e1/9d6614e7a8ff81fe6b6b750d16362ddb8ee73e3780e6c5fb90c37830892b/python_elo_system-2.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-16 15:53:31",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "python-elo-system"
}