Class: Tundengine::Strategies::Automatic

Inherits:
Base
  • Object
show all
Defined in:
lib/tundengine/strategies/automatic.rb

Direct Known Subclasses

Random

Instance Method Summary collapse

Instance Method Details

#declare!(player_in_round, declaration) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/tundengine/strategies/automatic.rb', line 13

def declare!(player_in_round, declaration)
  selected_declaration = declaration.self_or_yield do
    declare(player_in_round)
  end

  player_in_round.after_declaring!(selected_declaration)
end

#on_winning_trick!(player_in_round) ⇒ Object



21
22
23
# File 'lib/tundengine/strategies/automatic.rb', line 21

def on_winning_trick!(player_in_round)
  player_in_round.declare!
end

#play!(player_in_turn, card) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/tundengine/strategies/automatic.rb', line 5

def play!(player_in_turn, card)
  selected_card = card.self_or_yield do
    play(player_in_turn)
  end

  player_in_turn.after_playing!(selected_card)
end