Skip to content

Instantly share code, notes, and snippets.

@kenmazaika
Created November 9, 2015 22:09
Show Gist options
  • Save kenmazaika/99f8cdd343fe14bf556b to your computer and use it in GitHub Desktop.
Save kenmazaika/99f8cdd343fe14bf556b to your computer and use it in GitHub Desktop.
class Deck
RANKS = [:spades, :hearts, :diamonds, :clubs]
SUITS = [2,3,4,5,6,7,8,9,10,"J","Q","k","A"]
def initialize
@cards = Array.new
SUITS.each do |y|
RANKS.each do |x|
@cards << Card.new(x, y)
end
end
end
def shuffle
@cards.shuffle!
end
def output
@cards.each do |card|
card.output_card
end
end
def deal
card = @cards.shift
card.output_card
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment