-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBasic-ELO.py
71 lines (62 loc) · 2.03 KB
/
Basic-ELO.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
66
67
68
69
70
71
#variables
WinnerScore = 0
WinnerRank = 0
NewWinnerRank = 0
LoserScore = 0
LoserRank = 0
NewLoserRank = 0
UpperBoundary = 249
#score inputs
WinnerScore = int(input("Winner score: "))
LoserScore = int(input("Loser score: "))
#calculating player's ranks
while WinnerScore > UpperBoundary:
UpperBoundary += 250
WinnerRank += 1
UpperBoundary = 249
while LoserScore > UpperBoundary:
UpperBoundary += 250
LoserRank += 1
UpperBoundary = 249
print(".........................................")
#calculating point changes based on rank difference - with limits for changes <5 or >25
print("Winner's rank is ", WinnerRank, ", and Loser's rank is ", LoserRank, ", therefore:")
x = LoserRank - WinnerRank
PointsChange = 15 + x * 2
if PointsChange > 25:
PointsChange = 25
print("Overscore Clause - points change capped at 25")
elif PointsChange < 5:
PointsChange = 5
print("Underscore clause - points change capped at 5")
#applying changes
WinnerScore += PointsChange
print("Winner gains ", PointsChange, " points")
LoserScore -= PointsChange
print("Loser loses ", PointsChange, " points")
#clause to prevent negative points after applying changes
if LoserScore < 0:
LoserScore = 0
print(".........................................")
print("Negative Cap Clause - Loser's points fell negative, score was set to 0.")
print(".........................................")
#calculating players ranks after changes
while WinnerScore > UpperBoundary:
UpperBoundary += 250
NewWinnerRank += 1
UpperBoundary = 249
while LoserScore > UpperBoundary:
UpperBoundary += 250
NewLoserRank += 1
UpperBoundary = 249
#stating rank changes
if NewWinnerRank > WinnerRank:
print("Winner's rank has increased to ", NewWinnerRank)
WinnerRank = NewWinnerRank
else:
print("Winner's rank has not changed")
if NewLoserRank < LoserRank:
print("Loser's rank has decreased to ", NewLoserRank)
LoserRank = NewLoserRank
else:
print("Loser's rank has not changed")