comparison gamelib/animal.py @ 511:57f9077fb7fb

Remove some left-over code.
author Neil Muller <drnlmuller@gmail.com>
date Thu, 26 Nov 2009 23:33:49 +0000
parents 8fbff3505d1d
children 88bda6db953a
comparison
equal deleted inserted replaced
510:3e4bb2c9556c 511:57f9077fb7fb
375 cur_pos = self.pos 375 cur_pos = self.pos
376 path = [] 376 path = []
377 while steps < max_steps: 377 while steps < max_steps:
378 if not border_func(cur_pos): 378 if not border_func(cur_pos):
379 # Not walking the edge 379 # Not walking the edge
380 # Is there a 4-NEIGHBOUR, to path[-1], not in the path that
381 # is a continue
382 if not path:
383 # Rest of search will cover neighbours
384 return None
385 for cand in [path[-1] + x for x in NEIGHBOUR_4]:
386 if cand in path:
387 continue
388 if border_func(cand):
389 cur_pos = cand
390 break
391 return None 380 return None
392 path.append(cur_pos) 381 path.append(cur_pos)
393 if end_func(cur_pos): 382 if end_func(cur_pos):
394 # is there an 8-NEIGHBOUR that also satisfies end_func and is 383 # is there an 8-NEIGHBOUR that also satisfies end_func and is
395 # closer to target 384 # closer to target
396 dist = self.target.dist(cur_pos) 385 dist = self.target.dist(cur_pos)
397 fin_pos = None 386 fin_pos = None
398 for pos in [cur_pos + x for x in NEIGHBOUR_8]: 387 for pos in [cur_pos + x for x in NEIGHBOUR_8]:
388 if pos in path:
389 continue
399 if end_func(pos) and self.target.dist(pos) < dist: 390 if end_func(pos) and self.target.dist(pos) < dist:
400 fin_pos = pos 391 fin_pos = pos
401 dist = self.target.dist(pos) 392 dist = self.target.dist(pos)
402 if fin_pos: 393 if fin_pos:
403 path.append(fin_pos) 394 path.append(fin_pos)