Skip to content

Instantly share code, notes, and snippets.

@mikelovesrobots
Created December 2, 2016 00:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikelovesrobots/ec674b3a5b5e0cfd93648269bc0924ee to your computer and use it in GitHub Desktop.
Save mikelovesrobots/ec674b3a5b5e0cfd93648269bc0924ee to your computer and use it in GitHub Desktop.
rtanque bot
class MikeBlindBot < RTanque::Bot::Brain
NAME = 'MikeBlindBot'
include RTanque::Bot::BrainHelper
def tick!
## main logic goes here
@direction_degrees ||= 0
if self.sensors.position.on_top_wall?
@direction_degrees = -180
elsif self.sensors.position.on_bottom_wall?
@direction_degrees = 0
end
@turret_degrees ||= 0
@turret_degrees += 0.5
self.command.speed = MAX_BOT_SPEED
self.command.heading = RTanque::Heading.new_from_degrees(@direction_degrees)
self.command.turret_heading = RTanque::Heading.new_from_degrees(@turret_degrees)
self.command.fire MIN_FIRE_POWER
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment