README.md 2.07 KB
Newer Older
Pranas Ziaukas's avatar
Pranas Ziaukas committed
1
## Table Tennis Power Rankings
Pranas Ziaukas's avatar
Pranas Ziaukas committed
2

Pranas Ziaukas's avatar
Pranas Ziaukas committed
3
4
5
6
7
8
9
10
### Concept
Based on [Elo rating system](https://en.wikipedia.org/wiki/Elo_rating_system).

When Player A whose rating is $`R_A`$ defeats Player B whose rating is $`R_B`$, the unexpectedness of such an event is
```math
U = \frac{1}{1 + 10^{(R_A - R_B)/s}} .
```

11
A custom "jackpot" (formally a K-factor) is assigned to the match (1/10th of Elo spread for average players)
Pranas Ziaukas's avatar
Pranas Ziaukas committed
12
13
14
15
16
17
18
```math
K = \frac{2 s R}{10 (R_A + R_B)} .
```

The ratings are updated accordingly
```math
R_A^\prime = R_A + UK;
Pranas Ziaukas's avatar
Pranas Ziaukas committed
19
\ 
Pranas Ziaukas's avatar
Pranas Ziaukas committed
20
21
22
R_B^\prime = R_B - UK.
```

Pranas Ziaukas's avatar
Pranas Ziaukas committed
23
### Usage
Pranas Ziaukas's avatar
Pranas Ziaukas committed
24
```
Pranas Ziaukas's avatar
Pranas Ziaukas committed
25
26
27
28
29
30
31
32
33
34
35
36
Usage: ppong [OPTIONS]

  Adds matches to the gamebook.

Options:
  -p, --player TEXT       Player code.  [default: pz]
  -o, --opponent TEXT     Opponent code.
  -s, --score INTEGER...  Player/opponent win counts.  [required]
  --merge                 Merge to the latest tournament.  [default: False]
  --help                  Show this message and exit.
```

Pranas Ziaukas's avatar
Pranas Ziaukas committed
37
38


Pranas Ziaukas's avatar
Pranas Ziaukas committed
39
40
41
42
43
44
45
46
### Leaderboard
A static page is built in the `public/` directory.
```
Usage: build [OPTIONS]

  Builds the leaderboard output.

Options:
47
48
49
50
  --elo-base INTEGER    Initial ELO score.  [default: 1000]
  --elo-spread INTEGER  ELO advantage for 10-1.  [default: 300]
  --days-ago INTEGER    Show players active that many days ago.  [default: 90]
  --at-least INTEGER    Show at least that many players.  [default: 10]
Pranas Ziaukas's avatar
Pranas Ziaukas committed
51
  --help                Show this message and exit.
Pranas Ziaukas's avatar
Pranas Ziaukas committed
52
```
Pranas Ziaukas's avatar
Pranas Ziaukas committed
53
54
55
56



### Glossary
Pranas Ziaukas's avatar
Pranas Ziaukas committed
57
58
59
60
61
62
63
1. **Elo rating** - a method for calculating the relative skill levels. It's default starting score is $`R`$.
1. **Elo spread** - an arbitrary difference denoted $`s`$ (measured in Elo rating points) for players that are most likely to finish any given tournament with a score 10-1.
1. **Gamebook** - a database containing a list of players and a list of tournaments grouped by date.
1. **K-factor** - an amount of points that is distributed between a winner and a loser after a match.
1. **Leaderboard** - a dynamical Elo rating of players based on their historical performances. 
1. **Match** - an atomic event when one player wins against another player.
1. **Tournament** - a collection of matches.