Mercurial > rinkhals
comparison gamelib/gameboard.py @ 92:bea1b9364583
Refactor Fox so we can have different types. Add a greedy fox
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Wed, 02 Sep 2009 10:47:46 +0000 |
parents | 5494af02a0e8 |
children | fa8d8fc1bf5b |
comparison
equal
deleted
inserted
replaced
91:db78e8b1f8b0 | 92:bea1b9364583 |
---|---|
372 for other_fox in self.foxes: | 372 for other_fox in self.foxes: |
373 if other_fox.pos.x == x and other_fox.pos.y == y: | 373 if other_fox.pos.x == x and other_fox.pos.y == y: |
374 skip = True # Choose a new position | 374 skip = True # Choose a new position |
375 break | 375 break |
376 if not skip: | 376 if not skip: |
377 fox = animal.Fox((x, y)) | 377 roll = random.randint(0, 10) |
378 if roll < 9: | |
379 fox = animal.Fox((x, y)) | |
380 else: | |
381 fox = animal.GreedyFox((x, y)) | |
378 self.add_fox(fox) | 382 self.add_fox(fox) |
379 | 383 |
380 def fix_buildings(self): | 384 def fix_buildings(self): |
381 """Go through the level map looking for buildings that haven't | 385 """Go through the level map looking for buildings that haven't |
382 been added to self.buildings and adding them. | 386 been added to self.buildings and adding them. |