Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

just a simple player #31

Merged
merged 2 commits into from

2 participants

@jackdoe

killing the weakest players

@reedlaw reedlaw merged commit e23f463 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 12, 2012
  1. @jackdoe

    player jack

    jackdoe authored
  2. @jackdoe

    remove empty new line

    jackdoe authored
This page is out of date. Refresh to see the latest.
Showing with 13 additions and 0 deletions.
  1. +13 −0 players/jack.rb
View
13 players/jack.rb
@@ -0,0 +1,13 @@
+module Jack
+ def move
+ enemy = Game.world[:players].select{ |p| p != self && p.alive }.min { |a,b| a.stats[:health] <=> b.stats[:health] }
+ if enemy && self.stats[:health] > self.stats[:strength]
+ [:attack,enemy]
+ else
+ [:rest]
+ end
+ end
+ def to_s
+ "Jack"
+ end
+end
Something went wrong with that request. Please try again.