diff options
author | DavisLWebb <davislwebb@ymail.com> | 2014-04-23 20:22:11 -0400 |
---|---|---|
committer | DavisLWebb <davislwebb@ymail.com> | 2014-04-23 20:22:11 -0400 |
commit | 8423f93a586c4278ea25d3b10bb731e732be0ba9 (patch) | |
tree | 047dfbfadeaef781a3a9242e571e253467c9a849 /lib/scoring/winner_takes_all.rb | |
parent | c5e0aeb5a055797fe4f26fb9e6f9e163d5d7f718 (diff) | |
parent | ae97abc3f47a7209ef8367a5781ca72ada90ddec (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 |