Código del nivel 5, modo Beginner de RubyWarrior
class Player
def play_turn(warrior)
@health = 0 if not @health
if warrior.feel.empty?
(warrior.health < 20 and not taking_damage? warrior) ? warrior.rest! : warrior.walk!
else
warrior.feel.captive? ? warrior.rescue! : warrior.attack!
end
@health = warrior.health
end
def taking_damage?(warrior)
@health > warrior.health
end
end