Skip to content

Instantly share code, notes, and snippets.

@roymax
Last active December 20, 2015 15:29
Show Gist options
  • Save roymax/6154180 to your computer and use it in GitHub Desktop.
Save roymax/6154180 to your computer and use it in GitHub Desktop.
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
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