Sha256: 0f857aff891d806cbcbee076984316c1f7fb899380f8b9cebc7e5df0eceb1352
Contents?: true
Size: 990 Bytes
Versions: 2
Compression:
Stored size: 990 Bytes
Contents
require_relative 'playing_card' require_relative 'dealt_pile' require_relative 'dealing_pile' require_relative 'column_pile' require_relative 'foundation_pile' class GlimmerKlondikeSolitaire module Model class Game COLUMN_PILE_COUNT = 7 attr_reader :deck, :dealing_pile, :dealt_pile, :column_piles, :foundation_piles 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 def restart! @deck = new_deck @dealt_pile.reset! @dealing_pile.reset! @column_piles.each(&:reset!) @foundation_piles.each(&:reset!) end private def new_deck PlayingCard.deck.shuffle end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
glimmer_klondike_solitaire-1.1.0 | app/glimmer_klondike_solitaire/model/game.rb |
glimmer_klondike_solitaire-1.0.1 | app/glimmer_klondike_solitaire/model/game.rb |