Skip to content

Commit

Permalink
Adding southpolesteve
Browse files Browse the repository at this point in the history
  • Loading branch information
southpolesteve committed Apr 12, 2012
1 parent 085f657 commit f01b493
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions players/southpolesteve.rb
@@ -0,0 +1,28 @@
module SouthPoleSteve
def to_s
"South Pole Steve"
end

def move
return [:attack, killable_opponents.select{ |p| p.stats[:health] < 30 }.pop] unless killable_opponents.empty?

return [:attack, opponents.first] if opponents.size == 1 || stats[:health] >= 100

[:rest]
end

private

def opponents
Game.world[:players].select{ |p| p != self }
end

def killable_opponents
opponents.select { |o| can_kill?(o) }
end

def can_kill?(player)
points = stats[:strength] - (player.stats[:defense] / 2)
player.stats[:health] <= points
end
end

0 comments on commit f01b493

Please sign in to comment.