class Shithead::AI::DealIn
Attributes
player[R]
Public Class Methods
call(player)
click to toggle source
# File lib/shithead/ai/deal_in.rb, line 2 def self.call(player) new(player).call end
new(player)
click to toggle source
# File lib/shithead/ai/deal_in.rb, line 6 def initialize(player) @player = player end
Public Instance Methods
call()
click to toggle source
# File lib/shithead/ai/deal_in.rb, line 10 def call return if player.hand.empty? 3.times { place ordered.shift } end
Private Instance Methods
ordered()
click to toggle source
# File lib/shithead/ai/deal_in.rb, line 20 def ordered @ordered ||= player.hand.cards.sort_by(&:rank) end
place(card)
click to toggle source
# File lib/shithead/ai/deal_in.rb, line 24 def place(card) player.visible.add card player.hand.delete card end