Class: Shithead::Dealer
- Inherits:
-
Object
- Object
- Shithead::Dealer
- Defined in:
- lib/shithead/dealer.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(deck, players) ⇒ Dealer
constructor
A new instance of Dealer.
Constructor Details
#initialize(deck, players) ⇒ Dealer
Returns a new instance of Dealer.
2 3 4 5 |
# File 'lib/shithead/dealer.rb', line 2 def initialize(deck, players) @deck = deck @players = players end |
Instance Method Details
#call ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/shithead/dealer.rb', line 7 def call hidden_cards = players.collect { [] } hand_cards = players.collect { [] } 3.times do players.length.times do |index| hidden_cards[index] << deck.draw end end 6.times do players.length.times do |index| hand_cards[index] << deck.draw end end players.each_with_index do |player, index| player.hidden.replace hidden_cards[index] hand_cards[index].each { |card| player.hand.add card } Shithead::AI::DealIn.call player end end |