Skip to content

Instantly share code, notes, and snippets.

@luckyruby
Last active August 29, 2015 14:03
Show Gist options
  • Save luckyruby/60254a5d026e879ec641 to your computer and use it in GitHub Desktop.
Save luckyruby/60254a5d026e879ec641 to your computer and use it in GitHub Desktop.
class Deck
attr_reader :cards
RANKS = %w(2 3 4 5 6 7 8 9 T J Q K A)
SUITS = %w(s h c d)
def initialize
@cards = RANKS.product(SUITS).map {|r,s| {rank: RANKS.index(r)+2, suit: s, display: r+s}}
@cards.shuffle
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment