summaryrefslogtreecommitdiff
path: root/lib/scoring/winner_takes_all.rb
diff options
context:
space:
mode:
authorguntasgrewal <guntasgrewal@gmail.com>2014-04-22 19:13:01 -0400
committerguntasgrewal <guntasgrewal@gmail.com>2014-04-22 19:13:01 -0400
commit38c2ff9637018d88db7083c76c133da3a72f4c31 (patch)
treeae5c381e7fe9493abfe8fa6c700df64648246fe2 /lib/scoring/winner_takes_all.rb
parent3e86ffe1113a096541ea94567bffee79368fb863 (diff)
parent5c6d6dca48bf3d54f145e859e6d4c8b1befe1f09 (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.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/scoring/winner_takes_all.rb b/lib/scoring/winner_takes_all.rb
new file mode 100644
index 0000000..ad2471b
--- /dev/null
+++ b/lib/scoring/winner_takes_all.rb
@@ -0,0 +1,16 @@
+require 'ScoringAlgorithm'
+
+class WinnerTakesAll < ScoringAlgorithm
+
+ def self.score(match, interface)
+ match.players.each do |player|
+ scores[player.user_name] = scoreUser(match.win?(player))
+ end
+ scores
+ end
+
+
+ def self.score(win)
+ win.nil? ? 0.5 : win ? 1 : 0
+ end
+end \ No newline at end of file