class OfcpScoring::RoyaltiesCalculator
Constants
- BACK
- MIDDLE
Public Instance Methods
calculate_bonus(hand, position)
click to toggle source
# File lib/ofcp_scoring/royalties_calculator.rb, line 13 def calculate_bonus(hand, position) return calculate_front(hand) if position == :front return calculate_middle(hand) if position == :middle return calculate_back(hand) if position == :back end
Private Instance Methods
calculate_back(hand)
click to toggle source
# File lib/ofcp_scoring/royalties_calculator.rb, line 20 def calculate_back(hand) BACK[hand.rank_name] end
calculate_front(hand)
click to toggle source
# File lib/ofcp_scoring/royalties_calculator.rb, line 28 def calculate_front(hand) return 0 unless hand.rank_name == "Pair" bonus_accumulator = 0 bonus_start = 5 while hand.ranks.max > bonus_start bonus_accumulator += 1 bonus_start += 1 end bonus_accumulator end
calculate_middle(hand)
click to toggle source
# File lib/ofcp_scoring/royalties_calculator.rb, line 24 def calculate_middle(hand) MIDDLE[hand.rank_name] end