Skip to content

Instantly share code, notes, and snippets.

@keppy
Created May 29, 2012 23:03
Show Gist options
  • Save keppy/2831329 to your computer and use it in GitHub Desktop.
Save keppy/2831329 to your computer and use it in GitHub Desktop.
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