Class: Baron::GameRoundFlow

Inherits:
Object
  • Object
show all
Defined in:
lib/baron/game_round_flow.rb

Overview

GameRoundFlow manages the flow of rounds that occur throughout the game, deciding if there is a stock round, or operating round next as an example.

Instance Method Summary collapse

Constructor Details

#initialize(game) ⇒ GameRoundFlow

Initialize the game round flow

Examples:

Baron::GameRoundFlow.new(game)

13
14
15
16
# File 'lib/baron/game_round_flow.rb', line 13

def initialize(game)
  @upcoming_rounds = []
  @game = game
end

Instance Method Details

#current_roundBaron::Round

The current round in the game

This will return a stock round, operating round, auction round or some other round.

Examples:

game.current_round

28
29
30
31
32
33
34
35
# File 'lib/baron/game_round_flow.rb', line 28

def current_round
  @current_round ||= Round::InitialAuction.new(@game)
  if @current_round.over?
    @current_round = next_round
    @current_round.start if @current_round
  end
  @current_round
end