Skip to content

Commit

Permalink
Fix incorrect Low Ace check for Straight.
Browse files Browse the repository at this point in the history
Somehow an old, incorrect implementation stuck around. Begone!
  • Loading branch information
zolrath committed Apr 2, 2012
1 parent 8c9ef3b commit c1b79d3
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/poker_hand_job/hand_reader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ def self.read(hand)
hands.each{ |is_hand| return hand.send(is_hand) if hand.send(is_hand) }
end


def suit
hand.map(&:suit).uniq!
end
Expand Down Expand Up @@ -104,13 +103,12 @@ def is_three_of_a_kind?

def is_straight?
start = hand.first.value
if values == [*start..start+4] || values == [*start..start+3,14]
if values == [*start..start+4] || values == [2,3,4,5,14]
return Hand.new("Straight", hand, values.min)
end
false
end


def is_flush?
return Hand.new("Flush", hand, values.max, suit.first) if (suit.count == 1)
false
Expand Down

0 comments on commit c1b79d3

Please sign in to comment.