Class: TexasHoldem::Combinations::ThreeOfAKind

Inherits:
Combination
  • Object
show all
Defined in:
lib/texas-holdem/combinations/three_of_a_kind.rb

Constant Summary

Constants inherited from Combination

Combination::MAX_COMBINATION_LENGTH

Instance Attribute Summary

Attributes inherited from Combination

#cards, #cards_by_rank, #cards_by_suit, #combination_cards, #kicker_cards

Instance Method Summary collapse

Methods inherited from Combination

#<=>, #has_combination?, #initialize, #to_s

Constructor Details

This class inherits a constructor from TexasHoldem::Combinations::Combination

Instance Method Details

#compare_same_rank(other) ⇒ Object



12
13
14
# File 'lib/texas-holdem/combinations/three_of_a_kind.rb', line 12

def compare_same_rank(other)
  combination_cards[0] <=> other.combination_cards[0]
end

#get_combination_cards(cards) ⇒ Object



5
6
7
8
9
10
# File 'lib/texas-holdem/combinations/three_of_a_kind.rb', line 5

def get_combination_cards(cards)
  cards_by_rank.each do |rank, cards_of_same_rank|
    return cards_of_same_rank if cards_of_same_rank.length == 3
  end
  []
end