Skip to content

Instantly share code, notes, and snippets.

@jansanchez
Last active December 20, 2015 16:29
Show Gist options
  • Save jansanchez/6161868 to your computer and use it in GitHub Desktop.
Save jansanchez/6161868 to your computer and use it in GitHub Desktop.
Ruby Warrior - Level 4
# Advertencia: este código está horrible, los métodos no me funcionan, pero sirve para pasar
# ruby warrior level 4
#
class Player
def play_turn(warrior)
@health = warrior.health
if @needCure == nil
if @health < 18
if @health < 15
if @attack == nil
if @health < 3
warrior.walk! :backward
@needCure = true
else
warrior.walk!
@attack = true
end
else
warrior.attack!
@attack = nil
end
else
warrior.walk! :backward
@needCure = true
end
else
if warrior.feel.empty?
warrior.walk!
else
warrior.attack!
end
end
else
warrior.rest!
if @health < 8
@needCure = true
else
@needCure = nil
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment