Skip to content

Instantly share code, notes, and snippets.

@sukhchander
Last active December 20, 2015 11:49
Show Gist options
  • Save sukhchander/6125929 to your computer and use it in GitHub Desktop.
Save sukhchander/6125929 to your computer and use it in GitHub Desktop.
class Player
def play_turn(warrior)
# cool code goes here
warrior.walk!
end
end
class Player
def play_turn(warrior)
# cool code goes here
if warrior.feel.empty?
warrior.walk!
else
warrior.attack!
end
end
end
class Player
def play_turn(warrior)
# cool code goes here
if warrior.feel.empty?
if warrior.health < 10
warrior.rest!
else
warrior.walk!
end
else
warrior.attack!
end
end
end
class Player
def play_turn(warrior)
# cool code goes here
@health = warrior.health unless @health
if warrior.feel.empty?
if warrior.health < @health
warrior.walk!
elsif warrior.health < 12 # clue is 10%
warrior.rest!
else
warrior.walk!
end
else
warrior.attack!
end
@health = warrior.health
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment