League ranking for arbitrary numbers of competitors.
Project description
Given a collection of entrants and their scores, sort them and return their ranked points.
The mechanism used to allocate the ranked points is a generalised form of that used for the Student Robotics league points (quote from the SR rulebook):
The team with the most game points will be awarded 8 points towards the competition league. The team with the second most will be awarded 6. The team with the third most will be awarded 4 points, and the team with the fewest game points will be awarded 2 points. Teams whose robot was not entered into the round, or who were disqualified from the round, will be awarded no points.
Tied robots will be awarded the average of the points that their combined positions would be awarded. Thus, three robots tied for first place would receive 6 points each (since this is (8+6+4)/3).
The ranker supports an arbitrary number of entrants and zones (as long as there are fewer entrants than zones) and will return points which follow the pattern described above.
The points for the winning team will be 2 * the number of zones, points for subsequent places reduce by 2 points per place. Ties are resolved as described and as a result of the points per place reducing by two, the points for any entrant will always be an integer.
It supports Python 3.7+.
Tests
Tests can be run for the current interpreter by running ./run-tests or for all supported available interpreters by running tox.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file league-ranker-0.1.tar.gz
.
File metadata
- Download URL: league-ranker-0.1.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b08d17f912bbf14b7423b909f41fd901700949e91d0e7d9745619493a45106e |
|
MD5 | fd4024830685364b5776849b3b23db83 |
|
BLAKE2b-256 | c80e0aff4a7b9bd365a8bcda10fedf74a97d1b1a15c578479b44a6d9a18aee67 |
Provenance
File details
Details for the file league_ranker-0.1-py2.py3-none-any.whl
.
File metadata
- Download URL: league_ranker-0.1-py2.py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6812c88b2cb8f9df86e62b04d4ccb9c5f20c34b8cec85dffd2baa823e16e9578 |
|
MD5 | d8ba13557e1eff13bcb53b5d1b9ed97d |
|
BLAKE2b-256 | 8bb166cd391a6f15cb7ececd234d729ae1bee355647bcbe1e702cd2e8dd7b326 |