Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

to_f used instead of to_i in New Rating method #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/elo/rating.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Rating

# The new rating is... wait for it... the new rating!
def new_rating
(old_rating.to_f + change).to_i
(old_rating.to_f + change).to_f
end

private
Expand All @@ -38,15 +38,15 @@ def valid_result?

# The expected score is the probably outcome of the match, depending
# on the difference in rating between the two players.
#
#
# For more information visit
# {Wikipedia}[http://en.wikipedia.org/wiki/Elo_rating_system#Mathematical_details]
def expected
1.0 / ( 1.0 + ( 10.0 ** ((other_rating.to_f - old_rating.to_f) / 400.0) ) )
end

# The change is the points you earn or lose.
#
#
# For more information visit
# {Wikipedia}[http://en.wikipedia.org/wiki/Elo_rating_system#Mathematical_details]
def change
Expand Down