Skip to content

Instantly share code, notes, and snippets.

View ryan-scott-dev's full-sized avatar

Ryan Scott ryan-scott-dev

View GitHub Profile
class Player
def play_turn(warrior)
@direction = :forward if @direction.nil?
if warrior.look(@direction)[1].empty? and warrior.health == @health or @health.nil?
warrior.walk!
elsif warrior.look(@direction)[1].empty? and warrior.health < @health
if warrior.look(@direction)[1].enemy?
warrior.shoot!
end
elsif warrior.feel(@direction).enemy?