Skip to content

Instantly share code, notes, and snippets.

@gmacdougall
Created January 2, 2019 20:12
Show Gist options
  • Save gmacdougall/860e941393fe02c9d56d67f968c38a9d to your computer and use it in GitHub Desktop.
Save gmacdougall/860e941393fe02c9d56d67f968c38a9d to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
ranks = %w[2 3 4 5 6 7 8 9 T J Q K A]
suits = %w[C D H S]
initial_deck = ranks.flat_map do |rank|
suits.map do |suit|
"#{rank}#{suit}"
end
end
10.times do
deck = initial_deck.shuffle
result = 6.times.map do |hand|
"#{deck.pop(5).join(' ')}"
end
puts result.join('|')
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment