Last active
August 29, 2015 14:03
-
-
Save luckyruby/60254a5d026e879ec641 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
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