Class
Deck
In: cards.rb
Parent: Object

Deck
Hand
TopLevel
Methods

bury, count, draw, new, reset, shuffle, values,
Public Class methods
new()

-method for the creation of a deck of 52 cards

   # File cards.rb, line 5
5:   def initialize;reset;end
Public Instance methods
bury(c;)

-method to add a card to the bottom of the deck(the card should not already be in the deck)

    # File cards.rb, line 11
11:   def bury c;!@d.include?(c)&&@d.push(c);end
count()

-method to return a value with total number of cards in deck

    # File cards.rb, line 13
13:   def count;@d.size;end
draw()

-method to return the top card of a deck and removes it from the deck

   # File cards.rb, line 9
9:   def draw;@d.shift;end
reset()

-method to reset the deck to 52 cards

    # File cards.rb, line 15
15:   def reset;@d=[];Ranks.each{|i|Suits.each{|j|@d.push i+j}};end
shuffle()

-method to shuffle a deck of cards

   # File cards.rb, line 7
7:   def shuffle;h=[];@d.each{|crd|h.insert(rand(h.size+1),crd)};@d=h;end
values()

-method to return values of the cards in the deck ( H6, C3, SK, etc )

    # File cards.rb, line 17
17:   def values;@d.inject{|s,c|s<<" "+c};end