Skip to content

Instantly share code, notes, and snippets.

@gmemstr
Created April 26, 2017 19:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gmemstr/8446e4e4454a8c9a94631e7217d99b12 to your computer and use it in GitHub Desktop.
Save gmemstr/8446e4e4454a8c9a94631e7217d99b12 to your computer and use it in GitHub Desktop.
#
# 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