(self, zombies)
| 89 | |
| 90 | class Board: |
| 91 | def __init__(self, zombies): |
| 92 | self.zombies = zombies |
| 93 | random.shuffle(self.zombies) |
| 94 | |
| 95 | numberOfZombies = len(zombies) |
| 96 | numberOfSpaces = WIDTH * HEIGHT |
| 97 | if numberOfZombies >= numberOfSpaces: |
| 98 | raise Exception('Too many zombies for this size board.') |
| 99 | |
| 100 | # Place the zombie objects on the board: |
| 101 | for zombie in zombies: |
| 102 | while True: |
| 103 | x = random.randint(0, WIDTH - 1) |
| 104 | y = random.randint(0, HEIGHT - 1) |
| 105 | zombieAtXY = self.getZombieAt(x, y) |
| 106 | |
| 107 | if zombieAtXY == None: |
| 108 | zombie._x = x |
| 109 | zombie._y = y |
| 110 | break |
| 111 | |
| 112 | |
| 113 | def getZombieAt(self, x, y): |
no test coverage detected