Last active
August 29, 2015 14:09
-
-
Save elorest/7a8f6b7179d2dbd58b7f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
require 'rrobots' | |
class Elorest | |
include Robot | |
def tick events | |
@time = "hello" if time == 0 | |
say @time | |
# @planned ||= events['robot_scanned'].inspect | |
# say @planned | |
# turn_radar 1 | |
# turn_gun 1 | |
accelerate 1 if speed < 8 | |
if defined?(@dir) | |
@dir ||= 1 | |
elsif time % 1000 == 0 | |
@dir *= -1 | |
end | |
if events['robot_scanned'].empty? | |
turn @dir * 1 | |
fire(0.1) | |
# ((time % 2) - 1) | |
else | |
fire(1) | |
turn(0.5 * @dir) | |
end | |
turn 10 if speed < 2 | |
# case rand(1001) | |
# when 499..502 | |
# turn -10 | |
# when 507..510 | |
# turn 10 | |
# end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment