diff options
author | AndrewMurrell <amurrel@purdue.edu> | 2014-04-19 23:05:44 -0400 |
---|---|---|
committer | AndrewMurrell <amurrel@purdue.edu> | 2014-04-19 23:05:44 -0400 |
commit | 1512dfafba22473830118db37a55ef42ed2bd0d7 (patch) | |
tree | d5abd4af76d4cf828af8c9ec53a96231092fc0ab | |
parent | fdca9f33aadea4f139619f35e992760a0355d007 (diff) |
Added ScoringAlgorithms to lib
-rw-r--r-- | lib/scoring_algorithms/Recommended.rb | 8 | ||||
-rw-r--r-- | lib/scoring_algorithms/ScoringAlgorithm.rb | 6 |
2 files changed, 14 insertions, 0 deletions
diff --git a/lib/scoring_algorithms/Recommended.rb b/lib/scoring_algorithms/Recommended.rb new file mode 100644 index 0000000..c871fd4 --- /dev/null +++ b/lib/scoring_algorithms/Recommended.rb @@ -0,0 +1,8 @@ +class Recommended #< 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 + +#puts Recommended.score(4, true, false) diff --git a/lib/scoring_algorithms/ScoringAlgorithm.rb b/lib/scoring_algorithms/ScoringAlgorithm.rb new file mode 100644 index 0000000..ab7c81b --- /dev/null +++ b/lib/scoring_algorithms/ScoringAlgorithm.rb @@ -0,0 +1,6 @@ +class ScoringAlgorithm + + def score(*args) + end + +end |