summaryrefslogtreecommitdiff
path: root/lib/scoring_algorithms/ScoringAlgorithms.rb
diff options
context:
space:
mode:
authorAndrewMurrell <amurrel@purdue.edu>2014-04-19 23:31:43 -0400
committerAndrewMurrell <amurrel@purdue.edu>2014-04-19 23:31:43 -0400
commit4a492f3036ad05718e16289436f9840b4fa5331e (patch)
tree105d7717ef8c7b28385ec3911f1c0aef3ebf0f42 /lib/scoring_algorithms/ScoringAlgorithms.rb
parent1512dfafba22473830118db37a55ef42ed2bd0d7 (diff)
Added some more scoring functions in ScoringAlgorithms.rb
Diffstat (limited to 'lib/scoring_algorithms/ScoringAlgorithms.rb')
-rw-r--r--lib/scoring_algorithms/ScoringAlgorithms.rb28
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)