Class: Shithead::AI::Offer
- Inherits:
-
Object
- Object
- Shithead::AI::Offer
- Defined in:
- lib/shithead/ai/offer.rb
Constant Summary collapse
- EMPTY_SET =
Shithead::Set.new
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(player, top) ⇒ Offer
constructor
A new instance of Offer.
Constructor Details
#initialize(player, top) ⇒ Offer
Returns a new instance of Offer.
8 9 10 11 |
# File 'lib/shithead/ai/offer.rb', line 8 def initialize(player, top) @player = player @top = top end |
Class Method Details
.call(player, top) ⇒ Object
4 5 6 |
# File 'lib/shithead/ai/offer.rb', line 4 def self.call(player, top) new(player, top).call end |
Instance Method Details
#call ⇒ Object
13 14 15 16 17 18 |
# File 'lib/shithead/ai/offer.rb', line 13 def call draw_from_hidden if empty_hand? return EMPTY_SET if lowest_possible.nil? available.take lowest_possible end |