Class: RTanque::Bot::Command

Inherits:
Struct
  • Object
show all
Defined in:
lib/rtanque/bot/command.rb

Overview

Command provide output from the Brain about the current state of the Match

They are made available to Brain via Brain#command

All values are bound. Setting an out-of-bounds value will result in it being set to the max/min allowed value.

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Instance Attribute Details

- (Float?) fire_power=(value) (writeonly)

sets firing power. Setting to nil will stop firing. See #fire



17
18
19
# File 'lib/rtanque/bot/command.rb', line 17

def fire_power=(value)
  @fire_power = value
end

- (Float, RTanque::Heading) heading=(value) (writeonly)



17
18
19
# File 'lib/rtanque/bot/command.rb', line 17

def heading=(value)
  @heading = value
end

- (Float, RTanque::Heading) radar_heading=(value) (writeonly)



17
18
19
# File 'lib/rtanque/bot/command.rb', line 17

def radar_heading=(value)
  @radar_heading = value
end

- (Float) speed=(value) (writeonly)



17
18
19
# File 'lib/rtanque/bot/command.rb', line 17

def speed=(value)
  @speed = value
end

- (Float, RTanque::Heading) turret_heading=(value) (writeonly)



17
18
19
# File 'lib/rtanque/bot/command.rb', line 17

def turret_heading=(value)
  @turret_heading = value
end

Instance Method Details

- (Object) fire(power)

Command provide output from the Brain about the current state of the Match

They are made available to Brain via Brain#command

All values are bound. Setting an out-of-bounds value will result in it being set to the max/min allowed value.



17
18
19
20
21
# File 'lib/rtanque/bot/command.rb', line 17

Command = Struct.new(:speed, :heading, :radar_heading, :turret_heading, :fire_power) do
  def fire(power = 3)
    self.fire_power = power
  end
end