Skip to content

Commit

Permalink
He's not very smart, but the man has values
Browse files Browse the repository at this point in the history
  • Loading branch information
Chandler Abraham committed Apr 11, 2012
1 parent c8b812a commit 3b36e98
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions players/chandler.rb
@@ -0,0 +1,23 @@
module Chandler
ONCE_OF_STRENGTH = 50
def to_s
"*No rest for the wicked*"
end

def move
if ounce_of_strength_left_in_me?
[:attack, most_wicked_player]
else
[:rest] unless most_wicked_player == self #norest
end
end

def ounce_of_strength_left_in_me?
stats[:health] >= ONCE_OF_STRENGTH
end

def most_wicked_player
opponents = Game.world[:players].select{ |player| player != self}
opponents.sort!{|a,b| a.stats[:experience] <=> b.stats[:experience]}.first
end
end

0 comments on commit 3b36e98

Please sign in to comment.