Created
December 2, 2016 00:38
-
-
Save mikelovesrobots/ec674b3a5b5e0cfd93648269bc0924ee to your computer and use it in GitHub Desktop.
rtanque bot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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