Last active
December 20, 2015 15:29
-
-
Save roymax/6154180 to your computer and use it in GitHub Desktop.
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 = nil | |
def play_turn(warrior) | |
# cool code goes here | |
@health = warrior.health unless @health | |
if warrior.feel.empty? | |
if @health < 12 | |
warrior.rest! | |
else | |
warrior.walk! | |
end | |
@health = warrior.health | |
else | |
warrior.attack! | |
end | |
end | |
end | |
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 = nil | |
def play_turn(warrior) | |
# cool code goes here | |
@health = warrior.health unless @health | |
if warrior.feel.empty? | |
if @health < 18 | |
warrior.rest! | |
else | |
warrior.walk! | |
end | |
@health = warrior.health | |
else | |
if warrior.feel.captive? | |
warrior.rescue! | |
else | |
warrior.attack! | |
end | |
end | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment