diff options
author | Luke Shumaker <shumakl@purdue.edu> | 2014-04-20 16:03:24 -0400 |
---|---|---|
committer | Luke Shumaker <shumakl@purdue.edu> | 2014-04-20 16:03:24 -0400 |
commit | 641b619ae503ea70ea36c75d658f133775379deb (patch) | |
tree | 7e663e3a6aa9c8548413737da20c82f87a8459f7 /lib/scoring_algorithms/ScoringAlgorithms.rb | |
parent | 49f579f025235045840e17005fd84edc9e12f9eb (diff) | |
parent | 16750bab527d574867a64e3092f7335a028195cb (diff) |
Merge branch 'master' of github.com:LukeShu/leaguer
Diffstat (limited to 'lib/scoring_algorithms/ScoringAlgorithms.rb')
-rw-r--r-- | lib/scoring_algorithms/ScoringAlgorithms.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/scoring_algorithms/ScoringAlgorithms.rb b/lib/scoring_algorithms/ScoringAlgorithms.rb new file mode 100644 index 0000000..7f8ec12 --- /dev/null +++ b/lib/scoring_algorithms/ScoringAlgorithms.rb @@ -0,0 +1,28 @@ +class ScoringAlgorithm + def self.score(*args) + end +end + +class FibonacciPeerWithBlowout < ScoringAlgorithm + def self.score(votes, win, blowout) + fibonacci = Hash.new{ |h,k| h[k] = k < 2 ? k : h[k-1] + h[k-2] } + fibonacci[votes+3] + (win ? blowout ? 12 : 10 : blowout ? 5 : 7) + end +end + +class WinnerTakesAll < ScoringAlgorithm + def self.score(win) + win.nil? ? 0.5 : win ? 1 : 0 + end +end + +class MarginalPeer < ScoringAlgorithm + def self.score(rating) + rating + end +end + + +#puts Recommended.score(4, true, false) +#puts WinnerTakesAll.score(nil) +#puts WinnerTakesAll.score(true) |