Skip to content

Instantly share code, notes, and snippets.

@davelooi
Created February 3, 2015 13:17
Show Gist options
  • Save davelooi/951b65486bca89e49b09 to your computer and use it in GitHub Desktop.
Save davelooi/951b65486bca89e49b09 to your computer and use it in GitHub Desktop.
dave's RTanque
class DavidBot < RTanque::Bot::Brain
NAME = 'david_bot'
include RTanque::Bot::BrainHelper
def tick!
## main logic goes here
# use self.sensors to detect things
# See http://rubydoc.info/github/awilliams/RTanque/master/RTanque/Bot/Sensors
# use self.command to control tank
# See http://rubydoc.info/github/awilliams/RTanque/master/RTanque/Bot/Command
# self.arena contains the dimensions of the arena
# See http://rubydoc.info/github/awilliams/RTanque/master/frames/RTanque/Arena
command.fire_power = 1.5
command.speed = (sensors.speed + 1.5) % 20
command.heading = sensors.heading + BOT_RADIUS
command.turret_heading = sensors.turret_heading + BOT_RADIUS
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment