This repository has been archived by the owner on Sep 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
WoWs Personal Rating.py
65 lines (53 loc) · 1.78 KB
/
WoWs Personal Rating.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import json
def getRatingComment(rating):
# There are eight comment in total
if rating >= 0 and rating <= 750:
print('Keep it up')
elif rating <= 1100:
print('Below Average')
elif rating <= 1350:
print('Average')
elif rating <= 1550:
print('Good')
elif rating <= 1750:
print('Very Good')
elif rating <= 2100:
print('Great')
elif rating <= 2450:
print('Unicum')
elif rating <= 9999:
print('Super Unicum')
else:
print('Error')
print('\nWorld of Warship Personal Rating\n(http://wows-numbers.com/personal/rating)')
# load json file locally
with open('expected.json') as json_data:
data = json.load(json_data)
# Get total number of data
shipCount = len(data['data'])
damage = 0
frag = 0
winRate = 0
# Accumulating averageDamage, averageFrags and average winRate
for key in data['data'].keys():
damage += data['data'][key]['average_damage_dealt']
frag += data['data'][key]['average_frags']
winRate += data['data'][key]['win_rate']
expectedDamage = damage / shipCount
expectedFrags = frag / shipCount
expectedWinRate = winRate / shipCount
print('\n' + str(expectedDamage) + '\n' + str(expectedFrags) + '\n' + str(expectedWinRate) + '\n')
# Calculate with your data
# Change your data here... This is not accurate but only a estimated value. Please visit wows-number for more information
actualDmg = 43450
actualWins = 54.22
actualFrags = 0.89
rDmg = actualDmg/expectedDamage
rWins = actualWins/expectedWinRate
rFrags = actualFrags/expectedFrags
nDmg = max(0, (rDmg - 0.4) / (1 - 0.4))
nFrags = max(0, (rFrags - 0.1) / (1 - 0.1))
nWins = max(0, (rWins - 0.7) / (1 - 0.7))
PR = 700 * nDmg + 300 * nFrags + 150 * nWins - 150
print('Your personal rate is ' + str(PR))
getRatingComment(PR)