generated from mwc/project_game
Im stuck on testing my code Im worried my code isnt doing what i want it to but i cant test it to see
16 lines
457 B
Python
16 lines
457 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), 0))
|
|
game.add_agent(obstacle)
|
|
|
|
def should_spawn_obstacle(self, turn_number):
|
|
return randint(0, 1000) < turn_number
|