Created
February 5, 2017 12:53
-
-
Save linkin-park/bbc856e46f5d2cfbc79b3f5d18b5d058 to your computer and use it in GitHub Desktop.
Ruby Fun
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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