generated from mwc/project_game
16 lines
475 B
Python
16 lines
475 B
Python
from random import randint
|
|
from obstacle import Obstacle
|
|
|
|
class ObstacleSpawner:
|
|
display = False
|
|
|
|
def play_turn(self, game):
|
|
width, height = game.board_size
|
|
game.state['score'] += 1
|
|
if self.should_spawn_obstacle(game.turn_number):
|
|
obstacle = Obstacle((randint(0, width - 1), randint(0, width-1)))
|
|
game.add_agent(obstacle)
|
|
|
|
def should_spawn_obstacle(self, turn_number):
|
|
return randint(0, 1000) < turn_number
|