summaryrefslogtreecommitdiff
path: root/lib/scoring/winner_takes_all.rb
diff options
context:
space:
mode:
authorLuke Shumaker <shumakl@purdue.edu>2014-04-23 20:05:30 -0400
committerLuke Shumaker <shumakl@purdue.edu>2014-04-23 20:05:30 -0400
commitae97abc3f47a7209ef8367a5781ca72ada90ddec (patch)
treec95a6db509218f0c5119856d0e84faa6118b9617 /lib/scoring/winner_takes_all.rb
parenta55838983eb101e6f2d6dc3a4a03f5b0d4f36c04 (diff)
clean up lib/scoring
Diffstat (limited to 'lib/scoring/winner_takes_all.rb')
-rw-r--r--lib/scoring/winner_takes_all.rb28
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