Class: TexasHoldem::TwoPair
Constant Summary
collapse
- Pattern =
/(\d{1,2})[scdh] \1[scdh].*(\d{1,2})[scdh] \2[scdh]/
Instance Attribute Summary
Attributes inherited from PlayerHand
#cards
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from PlayerHand
#<=>, inherited, #initialize, #score
Class Method Details
.create(cards) ⇒ Object
158
159
160
|
# File 'lib/player_hand.rb', line 158
def self.create(cards)
new(cards) if cards.match Pattern
end
|
Instance Method Details
#base_score ⇒ Object
166
167
168
|
# File 'lib/player_hand.rb', line 166
def base_score
2
end
|
#name ⇒ Object
162
163
164
|
# File 'lib/player_hand.rb', line 162
def name
'two pair'
end
|
#relative_score ⇒ Object
170
171
172
|
# File 'lib/player_hand.rb', line 170
def relative_score
@cards[ Pattern , 2 ].to_i * 2
end
|
#remaining_cards ⇒ Object
174
175
176
|
# File 'lib/player_hand.rb', line 174
def remaining_cards
@cards.gsub(Pattern, '').gsub /\D/, ''
end
|