Skip to content

Instantly share code, notes, and snippets.

@jansanchez
Last active December 20, 2015 14:19
Show Gist options
  • Save jansanchez/6145636 to your computer and use it in GitHub Desktop.
Save jansanchez/6145636 to your computer and use it in GitHub Desktop.
Ruby Warrior - Level 3
# ruby warrior level 3
#
class Player
def play_turn(warrior)
if @needCure == nil
if warrior.health < 18
warrior.walk! :backward
@needCure = true
else
if warrior.feel.empty?
warrior.walk!
else
warrior.attack!
end
end
else
warrior.rest!
@needCure = nil
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment