Class: Baron::Action::RunTrains

Inherits:
CompanyAction show all
Defined in:
lib/baron/action/run_trains.rb

Overview

In this action the company runs its trains for an amount

This is generally a required action for every company operating turn, even if they have no trains (and therefore run for 0)

Instance Attribute Summary collapse

Attributes inherited from CompanyAction

#turn

Attributes inherited from Baron::Action

#player

Instance Method Summary collapse

Methods inherited from Baron::Action

#process, #symbol

Constructor Details

#initialize(turn, amount, corporate_bonus) ⇒ RunTrains

Create the run trains action

for osmething like a halt bonus, or mail contract

Examples:

Baron::Action::RunTrains.new(turn, 100, 10)

Parameters:

  • turn (Baron::Turn)
  • amount (Fixnum)

    The amount of the run

  • corporate_bonus (Fixnum)

    The additinonal amount that is provided


37
38
39
40
41
# File 'lib/baron/action/run_trains.rb', line 37

def initialize(turn, amount, corporate_bonus)
  super(turn)
  @amount = amount
  @corporate_bonus = corporate_bonus
end

Instance Attribute Details

#amountFixnum (readonly)

The amount that the company ran for

Examples:

action.amount

Returns:

  • (Fixnum)

16
17
18
# File 'lib/baron/action/run_trains.rb', line 16

def amount
  @amount
end

#corporate_bonusFixnum (readonly)

The amount of the corporate bonus paid

Examples:

action.corporate_bonus

Returns:

  • (Fixnum)

25
26
27
# File 'lib/baron/action/run_trains.rb', line 25

def corporate_bonus
  @corporate_bonus
end