Skip to content

Instantly share code, notes, and snippets.

@luckyruby
Last active August 29, 2015 14:03
Show Gist options
  • Save luckyruby/947acc8a58646bd17f37 to your computer and use it in GitHub Desktop.
Save luckyruby/947acc8a58646bd17f37 to your computer and use it in GitHub Desktop.
def flush?
hand = %w(Ts Qc 4c 3c Td Jc Ac)
suits = hand.map{|i| i[-1]}
counts = suits.each_with_object(Hash.new(0)) {|suit, counts| counts[suit] += 1}
counts.select {|k,v| v >= 5}.length != 0
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment