class RubyHoldem::Round

Constants

STAGES

Attributes

big_blinds[R]
players[R]
pot_amount[R]
small_blinds[R]
state[R]

Public Class Methods

new(players, small_blinds, big_blinds) click to toggle source
# File lib/ruby_holdem/round.rb, line 29
def initialize(players, small_blinds, big_blinds)
  @small_blinds = small_blinds
  @big_blinds = big_blinds
  @pot_amount = 0

  @players = players.map { |player| Player.new(player) }
  @move_history = MoveHistory.new
  @move_history_computations = MoveHistoryComputations.new(@players, @move_history)

  @dealer = Dealer.new
  @dealer.deal_hole_cards(@players)
end

Public Instance Methods

make_move(move_type, amount=nil) click to toggle source
# File lib/ruby_holdem/round.rb, line 42
def make_move(move_type, amount=nil)
  move = MoveFactory.new(self, player_in_turn, move_type, amount).build

  MoveValidator.new(self, move).validate

  unless move[:amount].nil?
    player_in_turn.current_bet_amount += move[:amount]
    @pot_amount += move[:amount]
  end

  @move_history.add_move(move)
end
next_stage() click to toggle source
# File lib/ruby_holdem/round.rb, line 55
def next_stage
  @move_history.next_stage
  @dealer.deal_community_cards(@move_history.stage)
end