class RubyArena::Ai

Attributes

command_parser[R]
robot[R]

Public Class Methods

new(args) click to toggle source
# File lib/ruby_arena/ai.rb, line 5
def initialize(args)
  @robot = args.fetch(:robot)
  @command_parser = args.fetch(:command_parser)
end

Public Instance Methods

tick() click to toggle source
# File lib/ruby_arena/ai.rb, line 10
def tick
  raise NotImplementedError, 'Your robot should implement tick method'
end

Private Instance Methods

accelerate() click to toggle source
# File lib/ruby_arena/ai.rb, line 52
def accelerate
  command_parser.accelerate
end
decelerate() click to toggle source
# File lib/ruby_arena/ai.rb, line 56
def decelerate
  command_parser.decelerate
end
fire() click to toggle source
# File lib/ruby_arena/ai.rb, line 60
def fire
  command_parser.fire
end
heading() click to toggle source
# File lib/ruby_arena/ai.rb, line 28
def heading
  @robot.heading
end
radar_view_angle() click to toggle source
# File lib/ruby_arena/ai.rb, line 36
def radar_view_angle
  robot.radar_view_angle
end
set_radar_view_angle(angle) click to toggle source
# File lib/ruby_arena/ai.rb, line 64
def set_radar_view_angle(angle)
  command_parser.radar_view_angle(angle)
end
speed() click to toggle source
# File lib/ruby_arena/ai.rb, line 24
def speed
  @robot.speed
end
time() click to toggle source
# File lib/ruby_arena/ai.rb, line 32
def time
  robot.time
end
turn(angle) click to toggle source
# File lib/ruby_arena/ai.rb, line 40
def turn(angle)
  command_parser.turn(angle)
end
turn_gun(angle) click to toggle source
# File lib/ruby_arena/ai.rb, line 44
def turn_gun(angle)
  command_parser.turn_gun(angle)
end
turn_radar(angle) click to toggle source
# File lib/ruby_arena/ai.rb, line 48
def turn_radar(angle)
  command_parser.turn_radar(angle)
end
x() click to toggle source
# File lib/ruby_arena/ai.rb, line 16
def x
  @robot.x
end
y() click to toggle source
# File lib/ruby_arena/ai.rb, line 20
def y
  @robot.y
end