-
-
Save johndel/5232077 to your computer and use it in GitHub Desktop.
Test tank bot for RTanque. Still baby steps :)
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 Baby < RTanque::Bot::Brain | |
NAME = 'baby' | |
include RTanque::Bot::BrainHelper | |
def tick! | |
test_sensors | |
if sensors.position.on_left_wall? | |
command.speed = 3 | |
command.heading = Math::PI | |
command.radar_heading = Math::PI | |
command.turret_heading = Math::PI | |
command.fire(3000000000) | |
else | |
"eftase" | |
end | |
end | |
end | |
def test_sensors | |
p "sensor ticks: #{sensors.ticks}" # Integer | |
p "sensor health: #{sensors.health}" # Float | |
p "sensor position: #{sensors.position}" # RTanque::Point | |
p "sensor heading: #{sensors.heading.inspect}" # RTanque::Heading | |
p "sensor speed: #{sensors.speed}" # Float | |
p "sensor radar: #{sensors.radar_heading}" # RTanque::Heading | |
p "sensor turret: #{sensors.turret_heading}" # RTanque::Heading | |
#sensors.radar.each do |scanned_bot| | |
# p scanned_bot | |
# scanned_bot: RTanque::Bot::Radar::Reflection | |
# Reflection(:heading, :distance, :name) | |
#end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment