Class: Baron::Round::OperatingRound

Inherits:
Baron::Round show all
Defined in:
lib/baron/round/operating_round.rb

Overview

An operating round in the game

In the operating round, each company (private, minor, and major) gets an operation which may include an opportunity to lay tiles, purchase tokens, run trains, and buy trains.

Instance Attribute Summary

Attributes inherited from Baron::Round

#game

Instance Method Summary collapse

Methods inherited from Baron::Round

#end

Constructor Details

#initialize(game) ⇒ OperatingRound

Create the operating round

Examples:

Baron::OperatingRound.new(game)

17
18
19
20
# File 'lib/baron/round/operating_round.rb', line 17

def initialize(game)
  @game = game
  set_turn_order
end

Instance Method Details

#current_turnBaron::Turn::StockTurn

The current stock turn of a player taking their actions

Examples:

round.current_turn

29
30
31
32
# File 'lib/baron/round/operating_round.rb', line 29

def current_turn
  @current_turn = @turn_order.shift if @current_turn.done?
  @current_turn
end

#over?Boolean

Is the current round over?

The operating round ends when all companies have taken turns

Examples:

round.over?

43
44
45
# File 'lib/baron/round/operating_round.rb', line 43

def over?
  !current_turn
end

#startvoid

This method returns an undefined value.

Start the round and execute any special rules

This pays out private companies at the start of every operating round

Examples:

round.start

56
57
58
# File 'lib/baron/round/operating_round.rb', line 56

def start
  pay_privates
end