changeset 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 bca2f4396de8
children d564ae258471
files TODO gamelib/animal.py
diffstat 2 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/TODO	Sat Sep 05 12:51:20 2009 +0000
+++ b/TODO	Sat Sep 05 13:00:09 2009 +0000
@@ -29,3 +29,5 @@
 * <confluence> We should have text images instead of buttons (in the various menus and toolbars).
 
 * Persistent high scores 
+
+* Better fox move logic
--- 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