Class: OfcpScoring::OrganizedHand

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/ofcp_scoring/organized_hand.rb

Instance Method Summary collapse

Constructor Details

#initialize(organized_hand) ⇒ OrganizedHand

Returns a new instance of OrganizedHand.



4
5
6
# File 'lib/ofcp_scoring/organized_hand.rb', line 4

def initialize(organized_hand)
  @hand = organized_hand
end

Instance Method Details

#all_suits_match?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/ofcp_scoring/organized_hand.rb', line 41

def all_suits_match?
  @hand[:all_suits_match]
end

#four_cards_match?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/ofcp_scoring/organized_hand.rb', line 37

def four_cards_match?
  @hand[:four_cards_match]
end

#ranksObject



8
9
10
# File 'lib/ofcp_scoring/organized_hand.rb', line 8

def ranks
  @hand[:ranks]
end

#ranks_in_order?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/ofcp_scoring/organized_hand.rb', line 45

def ranks_in_order?
  @hand[:ranks_in_order]
end

#sequencesObject



12
13
14
15
16
17
18
19
# File 'lib/ofcp_scoring/organized_hand.rb', line 12

def sequences
  ranks = @hand[:ranks].reverse
  prev = ranks[0]
  ranks.slice_before { |cur|
    prev, prev2 = cur, prev
    prev2 - 1 != prev
  }.to_a
end

#suitsObject



21
22
23
# File 'lib/ofcp_scoring/organized_hand.rb', line 21

def suits
  @hand[:suits]
end

#three_card_hand?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/ofcp_scoring/organized_hand.rb', line 49

def three_card_hand?
  @hand[:three_card_hand]
end

#three_cards_match?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/ofcp_scoring/organized_hand.rb', line 33

def three_cards_match?
  @hand[:three_cards_match]
end

#two_cards_match?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/ofcp_scoring/organized_hand.rb', line 25

def two_cards_match?
  @hand[:two_cards_match]
end

#two_different_cards_match?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/ofcp_scoring/organized_hand.rb', line 29

def two_different_cards_match?
  @hand[:two_different_cards_match]
end