Skip to content

Instantly share code, notes, and snippets.

@Bondrake
Created July 28, 2013 12:05
Show Gist options
  • Save Bondrake/6098344 to your computer and use it in GitHub Desktop.
Save Bondrake/6098344 to your computer and use it in GitHub Desktop.
class Player
attr_accessor :started, :firstkill
def play_turn(warrior)
if not @started
@started = true
warrior.pivot!
elsif warrior.look.select{|space| space.enemy?}.length > 0
warrior.shoot!
elsif warrior.look.select{|space| space.enemy?}.length == 0 and not @firstkill
@firstkill = true
warrior.pivot!
elsif warrior.feel.captive?
warrior.rescue!
elsif warrior.feel.wall?
warrior.pivot!
else
warrior.walk!
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment