Skip to content

Instantly share code, notes, and snippets.

@cromulus
Created July 7, 2014 13:49
Show Gist options
  • Save cromulus/c5d5e84b29ca7e47efee to your computer and use it in GitHub Desktop.
Save cromulus/c5d5e84b29ca7e47efee to your computer and use it in GitHub Desktop.
Ethan's Ruby Warrior
class Player
attr_accessor :previous_health
def play_turn(warrior)
#warrior.walk!(:forward)
if warrior.health < 15 and warrior.feel.empty?
warrior.rest!
elsif warrior.feel.empty?
warrior.walk!(:forward)
else
warrior.attack!(:forward)
end
@previous_health=warrior.health
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment