Created
April 26, 2017 19:09
-
-
Save gmemstr/8446e4e4454a8c9a94631e7217d99b12 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Overwatch Competitive Rank Point Algorithm ^TM ^^Copyright ^^^etc. | |
# Written by Gabriel Simmer, December 2016 | |
# Feel free to use this script in your own | |
# projects, just make sure to provide some attribution | |
# back to either this gist or my GitHub. <3 | |
# | |
def Calculate(time, points, deaths, elims, wins, lost): | |
rank = elims - (deaths * 0.25) + time + points + wins | |
print("Raw points: " + str(rank)) | |
if lost is True: # If player has lost the game | |
print("Player lost the game", end=" - ") | |
wins = wins - 1 # Remove 1 from total wins | |
print("Win streak: " + str(wins)) | |
if wins < -2: # If player has lost more than one game | |
lost_perc = (wins * 0.1) / 2 # Percentage to loose | |
print("On a " + str(wins) + | |
" winning streak, " + str(round(lost_perc * 100, 2)) + "%") | |
else: # If this is the first game the player has lost | |
print("First loss in the streak") | |
lost_perc = -0.1 # Small % removed | |
if lost is False: # If player has won the game | |
print("Player won game", end=" - ") | |
wins = wins + 1 # Add 1 to passed win streak | |
if wins is 0: | |
wins = 1 # Do I multiply by zero for no net gain? | |
# For now decided not to however I need to think about this | |
print("Wins: " + str(wins)) | |
lost_perc = (wins * 2) * 0.05 | |
print(str(round(lost_perc * 100, 2)) + "% of points gained.") | |
final = rank / 2 * lost_perc | |
print("Finished calculating rank points") | |
return round(final, 0) | |
if __name__ == '__main__': | |
# 2 minutes 52 to win, 2 points captured | |
# 12 player deaths, 30 eliminations | |
# Winning or losing streak of 1 won | |
# Did NOT win last game | |
rank = Calculate(151, 2, 12, 30, 1, False) | |
if rank < 0: | |
print("Lost " + str(rank * -1) + " competitive points") | |
else: | |
print("Gained " + str(rank) + " competitive points") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment