elo icon indicating copy to clipboard operation
elo copied to clipboard

How can I test your code?

Open alexandreag82 opened this issue 6 years ago • 1 comments

I need thing like this, but I'm beginner in python. How can I test your code?

I need print new rating (Player A have 2162 and will play 6 games) exp += expected(2162, 2395) exp += expected(2162, 2334) exp += expected(2162, 2311) exp += expected(2162, 2323) exp += expected(2162, 1600) exp += expected(2162, 1600)

alexandreag82 avatar Dec 14 '18 23:12 alexandreag82

Is this a general question about how to print something with python or how to use the functions this provides? If you just want to print anything you can use the print function.

print('Some text')
print(123)

If you want to use the functions, look at the readme. Here's a full example.

# import both functions
from elo import expected, elo

# calculate exp
exp = expected(2162, 2395)
exp += expected(2162, 2334)
exp += expected(2162, 2311)
exp += expected(2162, 2323)
exp += expected(2162, 1600)
exp += expected(2162, 1600)

# win_score is determined by giving 0 points for a lost, 0.5 for a drawn, and 1 for a won match
win_score = 2.5 # I just set it to a dummy value

# now calculate the new elo for your player
new_elo = elo(2162, exp, win_score, k=32)
# and print it
print(new_elo)

phecdaDia avatar Feb 03 '19 11:02 phecdaDia