Class: Tournament::ScoringStrategy::Basic

Inherits:
Object
  • Object
show all
Defined in:
lib/tournament/scoring_strategy.rb

Overview

Class representing a scoring strategy where correct picks are worth 2 X the round number

Instance Method Summary collapse

Instance Method Details

#descriptionObject



14
15
16
# File 'lib/tournament/scoring_strategy.rb', line 14

def description
  "Each correct pick is worth 2 times the round number."
end

#nameObject



11
12
13
# File 'lib/tournament/scoring_strategy.rb', line 11

def name
  'Basic'
end

#score(pick, winner, loser, round) ⇒ Object



8
9
10
# File 'lib/tournament/scoring_strategy.rb', line 8

def score(pick, winner, loser, round)
  winner != Tournament::Bracket::UNKNOWN_TEAM && pick == winner ? round * 2 : 0
end