Skip to content

Instantly share code, notes, and snippets.

Created May 17, 2014 03:32
Show Gist options
  • Save anonymous/b78f98acb57f4540f79d to your computer and use it in GitHub Desktop.
Save anonymous/b78f98acb57f4540f79d to your computer and use it in GitHub Desktop.
def new_deck
card_suits = [:clubs, :hearts, :diamonds, :spades]
card_values = (1..13).to_a
card_suits.product(card_values)
end
def deal_card(deck)
card_to_deal = deck.sample(1)
deck.delete(card_to_deal)
card_to_deal
end
my_deck = new_deck
my_first_card = deal_card(my_deck)
my_second_card = deal_card(my_deck)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment