Changeset 32:f5f74f1f3a0b


Ignore:
Timestamp:
Aug 30, 2009, 6:59:12 PM (11 years ago)
Author:
Neil Muller <drnlmuller@…>
Branch:
default
Convert:
svn:b4e93282-eac8-4b8b-b765-0f5d36de2b68@33
Message:

Discourage foxes from stepping on each other

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gamelib/animal.py

    r29 r32  
    7676            gameboard.remove_chicken(closest)
    7777            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
    7887        self.pos = (xpos, ypos)
    7988       
Note: See TracChangeset for help on using the changeset viewer.