# HG changeset patch # User Neil Muller # Date 1251658752 0 # Node ID f5f74f1f3a0bdb3e1f663261eb38ae1d59c614a4 # Parent 3c4db7bba432b09a06baba3dd84845b223fd0ceb Discourage foxes from stepping on each other diff -r 3c4db7bba432 -r f5f74f1f3a0b gamelib/animal.py --- a/gamelib/animal.py Sun Aug 30 18:56:09 2009 +0000 +++ b/gamelib/animal.py Sun Aug 30 18:59:12 2009 +0000 @@ -75,6 +75,15 @@ if closest.pos == self.pos: gameboard.remove_chicken(closest) self.full = True + for fox in gameboard.foxes: + if fox is not self: + if fox.pos[0] == xpos and fox.pos[1] == ypos: + if xpos != self.pos[0]: + xpos = self.pos[0] + elif ypos != self.pos[1]: + ypos = self.pos[1] + else: # We move a step away + xpos += 1 self.pos = (xpos, ypos)