Skip to content

Instantly share code, notes, and snippets.

@Restuta
Last active December 20, 2015 10:20
Show Gist options
  • Save Restuta/6115156 to your computer and use it in GitHub Desktop.
Save Restuta/6115156 to your computer and use it in GitHub Desktop.
class Player
def play_turn(warrior)
if warrior.health < @health && warrior.health < 12
warrior.walk!(:backward)
else
if warrior.health < 20 && warrior.health >= @health
warrior.rest!
else
if warrior.feel.wall?
warrior.walk!(:backward)
end
if warrior.feel.empty?
warrior.walk!
end
if warrior.feel.enemy?
warrior.attack!
end
if warrior.feel.captive?
warrior.rescue!
end
end
end
@health = warrior.health
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment