diff gamelib/animal.py @ 257:fcaae2cfe3cd

Make foxes less determistic when avoiding other foxes
author Neil Muller <drnlmuller@gmail.com>
date Sat, 05 Sep 2009 13:00:09 +0000
parents 844bfb23d4b6
children 445f746449fa
line wrap: on
line diff
--- a/gamelib/animal.py	Sat Sep 05 12:51:20 2009 +0000
+++ b/gamelib/animal.py	Sat Sep 05 13:00:09 2009 +0000
@@ -395,6 +395,9 @@
                 if cost < min_cost:
                     min_cost = cost
                     final_pos = poss
+                if cost == min_cost and random.randint(0, 1) > 0:
+                    # Add some randomness in this case
+                    final_pos = poss
         if not final_pos:
             # No good choice, so stay put
             return self.pos