# HG changeset patch # User Neil Muller # Date 1259278429 0 # Node ID 57f9077fb7fbc31f0f3cc050c22a2d74b2fc5000 # Parent 3e4bb2c9556c1f75409f7ddf425c30313ed0b2e0 Remove some left-over code. diff -r 3e4bb2c9556c -r 57f9077fb7fb gamelib/animal.py --- a/gamelib/animal.py Thu Nov 26 23:15:04 2009 +0000 +++ b/gamelib/animal.py Thu Nov 26 23:33:49 2009 +0000 @@ -377,17 +377,6 @@ while steps < max_steps: if not border_func(cur_pos): # Not walking the edge - # Is there a 4-NEIGHBOUR, to path[-1], not in the path that - # is a continue - if not path: - # Rest of search will cover neighbours - return None - for cand in [path[-1] + x for x in NEIGHBOUR_4]: - if cand in path: - continue - if border_func(cand): - cur_pos = cand - break return None path.append(cur_pos) if end_func(cur_pos): @@ -396,6 +385,8 @@ dist = self.target.dist(cur_pos) fin_pos = None for pos in [cur_pos + x for x in NEIGHBOUR_8]: + if pos in path: + continue if end_func(pos) and self.target.dist(pos) < dist: fin_pos = pos dist = self.target.dist(pos)