Mercurial > rinkhals
changeset 511:57f9077fb7fb
Remove some left-over code.
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Thu, 26 Nov 2009 23:33:49 +0000 |
parents | 3e4bb2c9556c |
children | b112bcf4d435 |
files | gamelib/animal.py |
diffstat | 1 files changed, 2 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- 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)