class GlimmerKlondikeSolitaire::Model::Game

Constants

COLUMN_PILE_COUNT

Attributes

column_piles[R]
dealing_pile[R]
dealt_pile[R]
deck[R]
foundation_piles[R]

Public Class Methods

new() click to toggle source
# File app/glimmer_klondike_solitaire/model/game.rb, line 14
def initialize
  @deck = new_deck
  @dealt_pile = DealtPile.new(self)
  @dealing_pile = DealingPile.new(self)
  @column_piles = COLUMN_PILE_COUNT.times.map {|n| ColumnPile.new(self, n + 1)}
  @foundation_piles = PlayingCard::SUITS.map {|suit| FoundationPile.new(self, suit)}
end

Public Instance Methods

restart!() click to toggle source
# File app/glimmer_klondike_solitaire/model/game.rb, line 22
def restart!
  @deck = new_deck
  @dealt_pile.reset!
  @dealing_pile.reset!
  @column_piles.each(&:reset!)
  @foundation_piles.each(&:reset!)
end

Private Instance Methods

new_deck() click to toggle source
# File app/glimmer_klondike_solitaire/model/game.rb, line 32
def new_deck
  PlayingCard.deck.shuffle
end