Mercurial > rinkhals
comparison gamelib/animal.py @ 32:f5f74f1f3a0b
Discourage foxes from stepping on each other
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Sun, 30 Aug 2009 18:59:12 +0000 |
parents | 2e88c680672c |
children | 03121c89d5fd |
comparison
equal
deleted
inserted
replaced
31:3c4db7bba432 | 32:f5f74f1f3a0b |
---|---|
73 elif min_vec[1] > 0: | 73 elif min_vec[1] > 0: |
74 ypos += 1 | 74 ypos += 1 |
75 if closest.pos == self.pos: | 75 if closest.pos == self.pos: |
76 gameboard.remove_chicken(closest) | 76 gameboard.remove_chicken(closest) |
77 self.full = True | 77 self.full = True |
78 for fox in gameboard.foxes: | |
79 if fox is not self: | |
80 if fox.pos[0] == xpos and fox.pos[1] == ypos: | |
81 if xpos != self.pos[0]: | |
82 xpos = self.pos[0] | |
83 elif ypos != self.pos[1]: | |
84 ypos = self.pos[1] | |
85 else: # We move a step away | |
86 xpos += 1 | |
78 self.pos = (xpos, ypos) | 87 self.pos = (xpos, ypos) |
79 | 88 |
80 | 89 |