Skip to content

Instantly share code, notes, and snippets.

@linkin-park
Created February 5, 2017 12:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save linkin-park/bbc856e46f5d2cfbc79b3f5d18b5d058 to your computer and use it in GitHub Desktop.
Save linkin-park/bbc856e46f5d2cfbc79b3f5d18b5d058 to your computer and use it in GitHub Desktop.
Ruby Fun
class Player
@health = 20
def play_turn(warrior)
if warrior.feel.empty? then
if warrior.health<@health then
@health = warrior.health
warrior.walk!
else
@health = warrior.health
warrior.rest!
end
else
warrior.attack!
end
end
end
error:
comparison of Fixnum with nil failed
Player.rb:6:in `<'
Player.rb:6:in `play_turn'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment