Created
August 5, 2013 04:29
-
-
Save leckylao/6153513 to your computer and use it in GitHub Desktop.
Ruby Warrior Epic Mode 3 years ago:
Level Score: 74
Time Bonus: 13
Clear Bonus: 17
Level Grade: S
Total Score: 526 + 104 = 630
Your average grade for this tower is: S Level 1: S Level 2: A Level 3: S Level 4: S Level 5: A Level 6: S Level 7: S Level 8: S Level 9: S
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 Player | |
def play_turn(warrior) | |
@action = false | |
@direction ||= :forward | |
# shoot_backward! | |
if warrior.look(:backward)[2].enemy? and !@action | |
warrior.shoot!(:backward) | |
@action = true | |
end | |
# walk_backward! | |
if warrior.look(:backward)[1].captive? and !@action | |
warrior.walk!(:backward) | |
@action = true | |
end | |
# rescue_backward! | |
if warrior.look(:backward)[0].captive? and !@action | |
warrior.rescue!(:backward) | |
@action = true | |
end | |
# pivot! | |
if !@action | |
for space in warrior.look | |
break if space.stairs? or space.captive? | |
@direction = :backward if space.wall? | |
end | |
end | |
# rescue! | |
if warrior.feel.captive? and !@action | |
warrior.rescue! | |
@action = true | |
end | |
# shoot! | |
if !@action | |
for space in warrior.look(@direction) | |
break if space.captive? | |
if space.enemy? and !@action | |
warrior.shoot!(@direction) | |
@action = true | |
end | |
end | |
end | |
# walk! | |
warrior.walk!(@direction) if !@action | |
end | |
end# End Class Player |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment