class Shithead::Deck

Constants

PLAYERS_PER_DECK_RATIO
SUITES
VALUES

Attributes

cards[R]

Public Class Methods

new(player_count = 1) click to toggle source
# File lib/shithead/deck.rb, line 6
def initialize(player_count = 1)
  @cards = []

  (player_count / PLAYERS_PER_DECK_RATIO).ceil.times do
    SUITES.each do |suite|
      VALUES.each do |value|
        @cards << Shithead::Card.new(suite, value)
      end
    end
  end

  @cards.shuffle!
end

Public Instance Methods

card_count() click to toggle source
# File lib/shithead/deck.rb, line 20
def card_count
  cards.length
end
draw() click to toggle source
# File lib/shithead/deck.rb, line 24
def draw
  cards.shift
end
empty?() click to toggle source
# File lib/shithead/deck.rb, line 28
def empty?
  cards.empty?
end