Created
May 29, 2012 23:03
-
-
Save keppy/2831329 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 initialize(hands, cards) | |
ranks = %w{ 2 3 4 5 6 7 8 9 T J Q K A } | |
suits = %w{ S H D C } | |
card_stack = Array.new | |
h = Array.new | |
suits.each {|suit| | |
ranks.size.times {|i| | |
card_stack << (ranks[i]+suit) | |
} | |
} | |
card_stack.shuffle! | |
hands.times { |y| h << {}} | |
hands.times do |x| (cards * x).upto(cards*(x+1)) { |z| h << card_stack[z]} | |
end | |
puts h | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment