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-1.0.3.tar.gz
.
File metadata
- Download URL: league-ranker-1.0.3.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 605c3f3832d1d801d848ea72b1bbe4a67dae3f3db5374d1084951a135836b0ae |
|
MD5 | 26c3e5eed4c5a2d07553372801cfb3f2 |
|
BLAKE2b-256 | 7223e9352a56ee75886abe33755a22aca3b6ba9b7d10358ead6051469f940224 |
File details
Details for the file league_ranker-1.0.3-py2.py3-none-any.whl
.
File metadata
- Download URL: league_ranker-1.0.3-py2.py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 05e430c241002268439c813018d50833b5e8dd72278caa3c68db37422e4475a4 |
|
MD5 | 05c9b6440346d5c86f659403f643fd50 |
|
BLAKE2b-256 | 96502a76922a74d8f55045d23d03fd3986dea43d254cd8da027d884e3d8c3773 |