Skip to main content

Rayter

tests

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

pip install rayter

Running Rayter Command Line Tool

rayter games_file.txt

Using Rayter as a library

Rayter can be used as a python library

>>> 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:

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

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:

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

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

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

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

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

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

Metadata

Release files for rayter 2.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rayter 2.1.0
File Size Uploaded Provenance Actions
rayter-2.1.0.tar.gz 7.4 kB Without provenance Details for rayter-2.1.0.tar.gz

Release files / rayter-2.1.0.tar.gz

Download URL rayter-2.1.0.tar.gz
Size 7.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ffb08c5e186f899ae8424cad8f396d49b5a7a53a25a721e05b10b635d9173e96
BLAKE2b-256 checksum
How to use checksums
2e01af4c33d9d4872521914a7b0e5db252180a3957c96cf0e6b5d6c6fbb287eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.2

Security for rayter 2.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page