Instantly share code, notes, and snippets.

# gmemstr/comprank.py Created Apr 26, 2017

 # # 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")