summaryrefslogtreecommitdiff
path: root/rubywarrior
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2013-04-24 08:40:48 -0600
committermo khan <mo@mokhan.ca>2013-04-24 08:40:48 -0600
commitd64bb991bdaa4240a3f7ec38b92f675048e2b27c (patch)
tree8d151a8fe3bc28816821955e841cdf4a27ca8225 /rubywarrior
parentfd0236ac87389ddc68498e23a555742ccba98cfc (diff)
extract hard coded constant
Diffstat (limited to 'rubywarrior')
-rw-r--r--rubywarrior/alimo-beginner/player.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/rubywarrior/alimo-beginner/player.rb b/rubywarrior/alimo-beginner/player.rb
index a30e0f3..aba09b9 100644
--- a/rubywarrior/alimo-beginner/player.rb
+++ b/rubywarrior/alimo-beginner/player.rb
@@ -1,4 +1,5 @@
class Player
+ FIFTY_PERCENT = 0.5
def play_turn(warrior)
@initial_health ||= warrior.health
if warrior.feel.empty?
@@ -10,8 +11,7 @@ class Player
end
def health_is_low(warrior)
- threshold = 0.5 * @initial_health
- p "threshold is #{threshold}, initial health: #{@initial_health}, current: #{warrior.health}"
+ threshold = FIFTY_PERCENT * @initial_health
warrior.health <= threshold
end
end