Last active
December 24, 2015 13:09
-
-
Save calumhalcrow/6803015 to your computer and use it in GitHub Desktop.
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 WarBastard < RTanque::Bot::Brain | |
NAME = 'WAR BASTARD' | |
include RTanque::Bot::BrainHelper | |
@direction = true | |
def tick! | |
command.speed = 8 | |
@direction = !@direction if rand(200) < 2 | |
if @direction | |
command.heading = sensors.heading + Math::PI / (rand(10) + 0.01) | |
else | |
command.heading = sensors.heading - Math::PI / (rand(10) + 0.01) | |
end | |
#command.radar_heading = Math::PI | |
#command.turret_heading = sensors.turret_heading + Math::PI / 5.0 | |
#sensors.radar.each do |scanned_bot| | |
##scanned_bot: RTanque::Bot::Radar::Reflection | |
#Reflection(:heading, :distance, :name) | |
#end | |
# | |
a = sensors.radar.first | |
if a and a[:name] != NAME | |
command.turret_heading = a[:heading] | |
else | |
command.radar_heading = sensors.radar_heading + Math::PI / 2.0 | |
end | |
command.fire(3) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment