Last active
August 29, 2015 14:03
-
-
Save luckyruby/947acc8a58646bd17f37 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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