class Tundengine::Player::InTurn

Attributes

in_round[R]
turn[R]

Public Class Methods

new(turn, player_in_round) click to toggle source
# File lib/tundengine/player/in_turn.rb, line 10
def initialize(turn, player_in_round)
  @turn     = turn
  @in_round = player_in_round
end

Public Instance Methods

after_playing!(card) click to toggle source
# File lib/tundengine/player/in_turn.rb, line 19
def after_playing!(card)
  playable_cards, beats = hand.playable_cards(turn.trick)
  if playable_cards.include? card
    hand.delete card
    turn.on_completed!(card, beats)
  else
    raise "cannot play card #{card} in trick with cards #{turn.trick.cards.map(&:to_s)} when your hand is #{@hand.map(&:to_s)}"
  end
end
play!(card = Cards::Null.instance) click to toggle source
# File lib/tundengine/player/in_turn.rb, line 15
def play!(card = Cards::Null.instance)
  strategy.play!(self, card)
end