class Rubots::Samples::Rotator

Rotates in place direction

Public Class Methods

new(map, me, targets) click to toggle source
# File lib/rubots/samples/rotator.rb, line 5
def initialize(map, me, targets)
  @direction = :left
end

Public Instance Methods

command(me, targets) click to toggle source
# File lib/rubots/samples/rotator.rb, line 9
def command(me, targets)
  if @direction == :left
    @direction = :right if me.angle == 270
    rotate_to 270
  else
    @direction = :left if me.angle == 89
    rotate_to 89
  end
end
name() click to toggle source
# File lib/rubots/samples/rotator.rb, line 19
def name
  "Rotator"
end