diff gamelib/animal.py @ 122:d2b19131d537

Don't continue the night if we're not doing anything anymore
author Neil Muller <drnlmuller@gmail.com>
date Wed, 02 Sep 2009 20:54:47 +0000
parents d539ef5a3333
children 2e3a05b9594d
line wrap: on
line diff
--- a/gamelib/animal.py	Wed Sep 02 20:54:45 2009 +0000
+++ b/gamelib/animal.py	Wed Sep 02 20:54:47 2009 +0000
@@ -150,6 +150,7 @@
         self.hunting = True
         self.dig_pos = None
         self.tick = 0
+        self.safe = False
 
     def _cost_tile(self, pos, gameboard):
         if gameboard.in_bounds(pos):
@@ -215,6 +216,7 @@
                 self.landmarks.pop() # Moving to the next landmark
             else:
                 # Safely back at the start
+                self.safe = True
                 return self.pos
         return self._find_best_path_step(self.landmarks[-1], gameboard)