diff options
author | tkimia <tkimia@purdue.edu> | 2014-04-23 20:38:19 -0400 |
---|---|---|
committer | tkimia <tkimia@purdue.edu> | 2014-04-23 20:38:19 -0400 |
commit | 7ff82b901705475f97e277a9f3f31756bd3ce948 (patch) | |
tree | 9353d3b18477598eb9a7403541595dc0a750ec9a /lib/scoring/winner_takes_all.rb | |
parent | 190bfeb784f9760326c54069d2dbf875a820c6ec (diff) | |
parent | a729106e956e051818bb2d37f1581f3bf3abcefd (diff) |
Merge branch 'master' of https://github.com/LukeShu/leaguer
Diffstat (limited to 'lib/scoring/winner_takes_all.rb')
-rw-r--r-- | lib/scoring/winner_takes_all.rb | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/lib/scoring/winner_takes_all.rb b/lib/scoring/winner_takes_all.rb index ad2471b..517dfd6 100644 --- a/lib/scoring/winner_takes_all.rb +++ b/lib/scoring/winner_takes_all.rb @@ -1,16 +1,20 @@ -require 'ScoringAlgorithm' - -class WinnerTakesAll < ScoringAlgorithm - - def self.score(match, interface) - match.players.each do |player| - scores[player.user_name] = scoreUser(match.win?(player)) +module Scoring + module WinnerTakesAll + def stats_needed + return [] end - scores - end + def score(match, interface) + scores = {} + match.players.each do |player| + scores[player.user_name] = score_user(match.win?(player)) + end + scores + end - def self.score(win) - win.nil? ? 0.5 : win ? 1 : 0 + private + def score_user(win) + win.nil? ? 0.5 : win ? 1 : 0 + end end -end
\ No newline at end of file +end |