Class: OfcpScoring::HandEvaluator

Inherits:
Object
  • Object
show all
Defined in:
lib/ofcp_scoring/hand_evaluator.rb

Instance Method Summary collapse

Constructor Details

#initialize(hand_factory = OfcpScoring::HandFactory.new, royalties_calculator = OfcpScoring::RoyaltiesCalculator.new) ⇒ HandEvaluator

Returns a new instance of HandEvaluator.



2
3
4
5
6
7
8
9
10
# File 'lib/ofcp_scoring/hand_evaluator.rb', line 2

def initialize(hand_factory = OfcpScoring::HandFactory.new, royalties_calculator = OfcpScoring::RoyaltiesCalculator.new)
  @hand_factory = hand_factory
  @royalties_calculator = royalties_calculator
  @hand_one_score = 0
  @hand_two_score = 0
  @hand_one_royalties = 0
  @hand_two_royalties = 0

end

Instance Method Details

#evaluate(hand_one, hand_two) ⇒ Object



11
12
13
14
15
16
# File 'lib/ofcp_scoring/hand_evaluator.rb', line 11

def evaluate(hand_one, hand_two)
  organized_hand_one = @hand_factory.build(hand_one)
  organized_hand_two = @hand_factory.build(hand_two)

  score_hands(organized_hand_one, organized_hand_two)
end