summaryrefslogtreecommitdiff
path: root/lib/scoring/winner_takes_all.rb
blob: 517dfd644ff68631aff191e27794b7740f3e6b5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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