rayter


Namerayter JSON
Version 2.1.0 PyPI version JSON
download
home_pagehttps://github.com/peterjaric/rayter
SummaryGame rating command line tool and python library
upload_time2024-10-09 20:56:13
maintainerNone
docs_urlNone
authorNone
requires_python>=3.6
licenseMIT
keywords game rating elo python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Rayter

![tests](https://github.com/peterjaric/rayter/workflows/Tests/badge.svg)

Rayter is a program for generating player ratings from a number of games,
with the results stored in a file.

It can be used in the form as a command line program, or as a Python library.

## Installing Rayter

<pre>
pip install rayter
</pre>


## Running Rayter Command Line Tool

<pre>
rayter games_file.txt
</pre>


## Using Rayter as a library

Rayter can be used as a python library

```python
>>> from rayter.rater import rate_single_game, SCORE_TYPE_HIGH_SCORE
>>> scores = [100, 93, 74]
>>> ratings = [1889, 1400, 1662]
>>> rating_changes = rate_single_game(scores, ratings, score_type=SCORE_TYPE_HIGH_SCORE)
>>> rating_changes
[-1.7346441947565552, 16.22528089887642, -14.49063670411985]
```

## Rayter file format

The rayter file format expected by the Rayter Command Line Tool is designed
to be easily created by hand using a text editor. Here is an example for a
file containing two games of Hearts:

<pre>
score_type lowscore

game 2011-12-24 22:00
Jessica     95
Hugo        77
Jonatan     89
Jakob       103

game 2011-12-24 23:19
Hugo        107
Jonatan     96
Peter       65
Jakob       70
</pre>

**score_type lowscore** means that in this game the goal is to have as
low score as possible. The options for `score_type` are `lowscore`,
`highscore` (the default, if score_type is not specified), and
`winner_takes_all` (used for games with binary results, e.g. Chess).

Number of whitespace characters doesn't matter.

The format of the timestamp is year-month-day hour:minute, where hour
is from 0 to 23. The timestamp is currently not used more than as an
identifier of the game.

## Rayter Algorithm

Every player starts with a rating of 1000. The sum of all ratings will
always be 1000 * the number of players in the league. So if one player
gets +60 rating in a game, and all other players lose rating, the sum
of their rating change will be -60.

If a player with a rating of 1200 is playing against an opponent with
a rating of 1000, the first player is expected to get 20% more points
than the second one. That means that if the first player scores 240
points in the game, and the second player scores 200, the rating
change of both players will be 0, since 240 divided by 200 equals 1200
divided by 1000.

Example:

Here are some results in a made-up card game:

<pre>
game 2011-12-24 23:19
Dahlia        27
John          15
Ahmed         14
Lei           10

game 2011-12-25 21:12
John          23
Dahlia        10
Lei           4
Ahmed         4
</pre>

After the first game, the ratings will look like this:

<pre>
Name             Games   Rating    Delta
Dahlia               1     1032       32
John                 1      995       -5
Ahmed                1      992       -8
Lei                  1      980      -20
</pre>

When the second game was played, the ratings changed to this:

<pre>
Name             Games   Rating    Delta
John                 2     1058       62
Dahlia               2     1029       -3
Ahmed                2      962      -30
Lei                  2      951      -30
</pre>

For the full details see the `rate_single_game()` function in `rater.py`.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/peterjaric/rayter",
    "name": "rayter",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "game, rating, elo, python",
    "author": null,
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/2e/01/af4c33d9d4872521914a7b0e5db252180a3957c96cf0e6b5d6c6fbb287eb/rayter-2.1.0.tar.gz",
    "platform": null,
    "description": "# Rayter\n\n![tests](https://github.com/peterjaric/rayter/workflows/Tests/badge.svg)\n\nRayter is a program for generating player ratings from a number of games,\nwith the results stored in a file.\n\nIt can be used in the form as a command line program, or as a Python library.\n\n## Installing Rayter\n\n<pre>\npip install rayter\n</pre>\n\n\n## Running Rayter Command Line Tool\n\n<pre>\nrayter games_file.txt\n</pre>\n\n\n## Using Rayter as a library\n\nRayter can be used as a python library\n\n```python\n>>> from rayter.rater import rate_single_game, SCORE_TYPE_HIGH_SCORE\n>>> scores = [100, 93, 74]\n>>> ratings = [1889, 1400, 1662]\n>>> rating_changes = rate_single_game(scores, ratings, score_type=SCORE_TYPE_HIGH_SCORE)\n>>> rating_changes\n[-1.7346441947565552, 16.22528089887642, -14.49063670411985]\n```\n\n## Rayter file format\n\nThe rayter file format expected by the Rayter Command Line Tool is designed\nto be easily created by hand using a text editor. Here is an example for a\nfile containing two games of Hearts:\n\n<pre>\nscore_type lowscore\n\ngame 2011-12-24 22:00\nJessica     95\nHugo        77\nJonatan     89\nJakob       103\n\ngame 2011-12-24 23:19\nHugo        107\nJonatan     96\nPeter       65\nJakob       70\n</pre>\n\n**score_type lowscore** means that in this game the goal is to have as\nlow score as possible. The options for `score_type` are `lowscore`,\n`highscore` (the default, if score_type is not specified), and\n`winner_takes_all` (used for games with binary results, e.g. Chess).\n\nNumber of whitespace characters doesn't matter.\n\nThe format of the timestamp is year-month-day hour:minute, where hour\nis from 0 to 23. The timestamp is currently not used more than as an\nidentifier of the game.\n\n## Rayter Algorithm\n\nEvery player starts with a rating of 1000. The sum of all ratings will\nalways be 1000 * the number of players in the league. So if one player\ngets +60 rating in a game, and all other players lose rating, the sum\nof their rating change will be -60.\n\nIf a player with a rating of 1200 is playing against an opponent with\na rating of 1000, the first player is expected to get 20% more points\nthan the second one. That means that if the first player scores 240\npoints in the game, and the second player scores 200, the rating\nchange of both players will be 0, since 240 divided by 200 equals 1200\ndivided by 1000.\n\nExample:\n\nHere are some results in a made-up card game:\n\n<pre>\ngame 2011-12-24 23:19\nDahlia        27\nJohn          15\nAhmed         14\nLei           10\n\ngame 2011-12-25 21:12\nJohn          23\nDahlia        10\nLei           4\nAhmed         4\n</pre>\n\nAfter the first game, the ratings will look like this:\n\n<pre>\nName             Games   Rating    Delta\nDahlia               1     1032       32\nJohn                 1      995       -5\nAhmed                1      992       -8\nLei                  1      980      -20\n</pre>\n\nWhen the second game was played, the ratings changed to this:\n\n<pre>\nName             Games   Rating    Delta\nJohn                 2     1058       62\nDahlia               2     1029       -3\nAhmed                2      962      -30\nLei                  2      951      -30\n</pre>\n\nFor the full details see the `rate_single_game()` function in `rater.py`.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Game rating command line tool and python library",
    "version": "2.1.0",
    "project_urls": {
        "Code": "https://github.com/peterjaric/rayter",
        "Documentation": "https://github.com/peterjaric/rayter",
        "Homepage": "https://github.com/peterjaric/rayter",
        "Issue tracker": "https://github.com/peterjaric/rayter/issues"
    },
    "split_keywords": [
        "game",
        " rating",
        " elo",
        " python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2e01af4c33d9d4872521914a7b0e5db252180a3957c96cf0e6b5d6c6fbb287eb",
                "md5": "d926c2932d28622297e6a4d30396dceb",
                "sha256": "ffb08c5e186f899ae8424cad8f396d49b5a7a53a25a721e05b10b635d9173e96"
            },
            "downloads": -1,
            "filename": "rayter-2.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "d926c2932d28622297e6a4d30396dceb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 7434,
            "upload_time": "2024-10-09T20:56:13",
            "upload_time_iso_8601": "2024-10-09T20:56:13.959313Z",
            "url": "https://files.pythonhosted.org/packages/2e/01/af4c33d9d4872521914a7b0e5db252180a3957c96cf0e6b5d6c6fbb287eb/rayter-2.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-09 20:56:13",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "peterjaric",
    "github_project": "rayter",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "rayter"
}
        
Elapsed time: 0.38188s