summaryrefslogtreecommitdiff
path: root/lib/scoring/winner_takes_all.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/scoring/winner_takes_all.rb')
-rw-r--r--lib/scoring/winner_takes_all.rb20
1 files changed, 20 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..517dfd6
--- /dev/null
+++ b/lib/scoring/winner_takes_all.rb
@@ -0,0 +1,20 @@
+module Scoring
+ module WinnerTakesAll
+ def stats_needed
+ return []
+ end
+
+ def score(match, interface)
+ scores = {}
+ match.players.each do |player|
+ scores[player.user_name] = score_user(match.win?(player))
+ end
+ scores
+ end
+
+ private
+ def score_user(win)
+ win.nil? ? 0.5 : win ? 1 : 0
+ end
+ end
+end