# HG changeset patch # User Neil Muller # Date 1258785859 0 # Node ID bdc8bc78a796cab647aa2ec87103fb3abc705c43 # Parent f8072b2d6dd14863452c419c7990619386d85219 Handle corner case aroudn entering the map diff -r f8072b2d6dd1 -r bdc8bc78a796 gamelib/animal.py --- a/gamelib/animal.py Fri Nov 20 23:04:38 2009 +0000 +++ b/gamelib/animal.py Sat Nov 21 06:44:19 2009 +0000 @@ -344,7 +344,9 @@ min_dist = dist min_cost = cost best = point - if min_cost < 20: + if min_cost < 20 or not gameboard.in_bounds(self.pos): + # If we're not on the gameboard yet, there's no point in looking + # for an optimal path. return best # Else expensive step, so think further direct_path = self._gen_path(self.pos, final_pos)